【发布时间】:2017-02-21 00:06:52
【问题描述】:
我正在尝试设置调度单事件 cron wp_schedule_single_event 函数,我通过将第一个参数传递为 strtotime('+1 days'); 进行检查,如果我执行以下操作,它将完美设置 cron 24 小时在它下面设置 12 小时 无论如何?
$last_date_of_membership = "19-02-2017"; // d-m-y europe style
$penalty_day = strtotime($last_date_of_membership."+1 days");
wp_schedule_single_event($penalty_day,'some_hook_name');
它只是安排 12 小时而不是 24 小时,后来我尝试使用 h:i:s 仍然是相同的 12 小时是在 cron 中安排的。
我检查了 wordpress 的文档,其中声明使用 unix 时间戳,即 gmt https://codex.wordpress.org/Function_Reference/wp_schedule_single_event
在调度 cron 中我们不能使用从日期转换的 strtotime 有什么限制吗?如果是这样,请建议其他替代方案来解决此问题。
注意:我只是指定了明天的日期作为示例。
有什么好的建议吗?
谢谢。
【问题讨论】: