【问题标题】:wp_schedule_single_event schedule with specific date?具有特定日期的 wp_schedule_single_event 时间表?
【发布时间】: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 有什么限制吗?如果是这样,请建议其他替代方案来解决此问题。

注意:我只是指定了明天的日期作为示例。

有什么好的建议吗?

谢谢。

【问题讨论】:

    标签: php wordpress cron


    【解决方案1】:

    最后我想出了时间格式的解决方案,将小时分钟和秒作为 24 小时格式传递,如果是 12 小时,那么下午 1 点被认为是上午,它安排了 12 小时。希望它可以帮助某人将来避免此类问题。

    谢谢。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-09-12
      • 1970-01-01
      • 1970-01-01
      • 2013-10-07
      • 2020-10-06
      • 2018-09-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多