PHP函数接收cron字符串并返回下一个运行时间戳 [英] PHP function that receive a cron string and return the next run timestamp
本文介绍了PHP函数接收cron字符串并返回下一个运行时间戳的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要开发一个应该能够在不支持crontab的服务器上工作的任务系统。
我问是否有任何现有的代码可以采用cron字符串(例如'0 0,12 1 * / 2 *'并返回下一个计划运行的时间戳。
如果这样的代码不能
它还会计算最后一次计划的运行
I need to develop a task system that should be able to work on servers that doesn't support crontab.
I'm asking if there is any existing code that can take a cron string (e.g. '0 0,12 1 */2 *' and return the timestamp of the next scheduled run.
If such a code couldn't be found then how should I start with that?
解决方案
You could use this class PHP-Parse-cron-strings-and-compute-schedules
It'll also compute the last scheduled run
这篇关于PHP函数接收cron字符串并返回下一个运行时间戳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文