dtjo87679 2011-03-08 13:24
浏览 26
已采纳

Paypal PHP Cronjob

I've got default code from previous php cronjob file, but it setted for 24 hours cronjob. How do I set it to 1 hour (60 minutes) cronjob?

PHP cronjob:

$diff = array();
function date_diff($d1, $d2){
    $d1 = (is_string($d1) ? strtotime($d1) : $d1);
    $d2 = (is_string($d2) ? strtotime($d2) : $d2);

    $diff_secs = abs($d1 - $d2);
    $base_year = min(date("Y", $d1), date("Y", $d2));

    $diff = mktime(0, 0, $diff_secs, 1, 1, $base_year);
    return array(
        "years" => date("Y", $diff) - $base_year,
        "months_total" => (date("Y", $diff) - $base_year) * 12 + date("n", $diff) - 1,
        "months" => date("n", $diff) - 1,
        "days_total" => floor($diff_secs / (3600 * 24)),
        "days" => date("j", $diff) - 1,
        "hours_total" => floor($diff_secs / 3600),
        "hours" => date("G", $diff),
        "minutes_total" => floor($diff_secs / 60),
        "minutes" => (int) date("i", $diff),
        "seconds_total" => $diff_secs,
        "seconds" => (int) date("s", $diff)
    );
} 

 $timest=mysql_result($res,$i,"timestamp");
    $timenow = time();

    $diffArray = date_diff($timest,$timenow);

    // needs attention ########################
    if($diffArray['hours']>=1){
        $yes = true;
        mysql_query("UPDATE services SET moneyback='$custId' WHERE customer='$custId'")  or die(mysql_error());
        fwrite($log,$custId."money back void");
        fclose($log);
        exit;
    }
  • 写回答

1条回答 默认 最新

  • duanjigua5753 2011-03-08 13:44
    关注

    isn't this worked?

    if($diffArray['minutes_total']>=60){
    

    after changing the you need to setup cron job also. for this you need to configure your cornjob by editing the corntab

    for that issue in command line

    crontab -e
    

    and then change the value to

    0 * * * * wget -O - -q -t 1 http://mysite/cron.php
    

    change the exiting value(it might be) from 0 0 * * * to 0 * * * *

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 用hfss做微带贴片阵列天线的时候分析设置有问题
  • ¥50 我撰写的python爬虫爬不了 要爬的网址有反爬机制
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥120 计算机网络的新校区组网设计
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据
  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等