gpt4 book ai didi

php - Paypal PHP Cronjob

转载 作者:太空宇宙 更新时间:2023-11-03 16:20:34 24 4
gpt4 key购买 nike

我从以前的php cronjob文件中获得了默认代码,但设置为24小时cronjob。如何将其设置为1小时(60分钟)的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;
}

最佳答案

这行不通吗?

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


更改后,您还需要设置cron作业。
为此,您需要通过编辑corntab来配置cornjob

在命令行中解决该问题

crontab -e


然后将值更改为

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


将现有值(可能是)从 0 0 * * *更改为 0 * * * *

关于php - Paypal PHP Cronjob,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5233069/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com