且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在特定间隔(例如每天一次)中运行PHP脚本?

更新时间:2023-02-22 19:53:23

如果您不能或不想使用cron,则只有在访问页面时才可以更新它.您可以缓存HTTP请求的结果,并且仅在缓存的时间超过一天或您选择的任何间隔时才在页面加载时对其进行更新.

If you can't or don't want to use use cron and it's ok to update it only when the page is accessed. You could cache the result of the HTTP request and only update it on a page load it if the cache is older than a day or whatever interval you choose.