问题描述
如果我可以完全访问服务器,我可能会想出一种方法来做到这一点,但问题是它只是一个托管服务,除了FTP 访问外,我什么都没有.>
我想定期运行一个 PHP 脚本来检查过时/损坏的内容、聚合新内容、删除未使用的文件等,但是该脚本可能需要长达 60 秒来执行(由于内容的聚合),我觉得在处理更新一小时后访问该网站的第一个用户的请求时执行它就像一个笨蛋:P
24/7 离开我的家用电脑来安排请求不是一种选择.
您可以使用在线 cron 服务来假装您拥有 cron 访问权限.
用你想执行的内容创建php文件
免费 Cron 在线网站
设置您的免费在线 cron 以每 x 分钟执行一次该文件.
I'd probably figure out a way to do this if I had full access to the server, however the problem is it's just a hosting service which leaves me with nothing but FTP access.
I would like to run a PHP script periodically to check for outdated/broken content, aggregate new content, delete files not in use etc, however the script can take up to 60 seconds to execute (due to aggregation of content) and I feel like an ass to just execute it while processing a request of the first user that visits the website an hour after it's been updated :P
Leaving my home PC on 24/7 to schedule requests is not an option.
You can use an online cron service to essentially pretend like you have cron access.
Create php file with contents you would like executed
Free Cron Online Website
Set up your free online cron to execute that file every x minutes.
这篇关于定期执行 PHP 脚本的最佳方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!



大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)