Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/64.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Paypal PHP Cronjob_Php_Cron_Paypal - Fatal编程技术网

Paypal PHP Cronjob

Paypal PHP Cronjob,php,cron,paypal,Php,Cron,Paypal,我从以前的php cronjob文件中获得了默认代码,但它设置为24小时cronjob。如何将其设置为1小时60分钟 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 - $

我从以前的php cronjob文件中获得了默认代码,但它设置为24小时cronjob。如何将其设置为1小时60分钟

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;
    }
这不管用吗

if($diffArray['minutes_total']>=60){
更改后,还需要设置cron作业。 为此,您需要通过编辑corntab来配置cornjob

在命令行中解决该问题

crontab -e
然后将值更改为

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

更改现有值它可能从0***到0****

何时升级时间戳列?代码基本上检查数据库表时间戳。从时间戳开始24小时!但如果那样的话,我只需要60分钟possible@boyee007顺便问一下,你是如何安排这份工作的?上面的php代码不执行phpcode。事实上,它会检查是否每1小时执行一次。你在crontab中设置了cronjob吗?@mahesh:我刚刚在上面添加了cronjob php函数。这就是我需要知道的,如何将时间改为1小时而不是24小时!我得到了在cron执行后保存和更新数据库的其余代码@boyee007,好的,现在这个文件需要从外部程序调用。为此,您需要在unix中使用corntabif,在windows中使用windows调度器。您使用哪个操作系统进行设置?@mahesh:我的服务器正在运行unix服务器应该是corntab。cron作业在24小时后执行外部文件paypal-ipn.php。我将尝试上面的解决方案。不知道它是否有效:@mahesh:是的。我刚检查过!实际上它就在那里哈哈。你想怎么改成1小时?有默认值*