What options are there for executing a PHP script at a certain time every day?

前端 未结 9 697
没有蜡笔的小新
没有蜡笔的小新 2020-12-12 06:58

I have a PHP script that needs to be run at certain times every weekday. Is cron or Windows task scheduler the only way to do this?
Is there a way to set th

9条回答
  •  既然无缘
    2020-12-12 07:25

    Depends how exact the timing needs to be. A technique I've seen used (dubbed "poor man's cron") is to have a frequently accessed script (a site's home page, for example) fire off a task on the first page load after a certain time (kept track of in the database).

    If you need any sort of guaranteed accuracy, though, cron or a Windows scheduled task is really the best option. If your host doesn't support them, it's time to get a better one.

提交回复
热议问题