<i id='jTaWQ'><tr id='jTaWQ'><dt id='jTaWQ'><q id='jTaWQ'><span id='jTaWQ'><b id='jTaWQ'><form id='jTaWQ'><ins id='jTaWQ'></ins><ul id='jTaWQ'></ul><sub id='jTaWQ'></sub></form><legend id='jTaWQ'></legend><bdo id='jTaWQ'><pre id='jTaWQ'><center id='jTaWQ'></center></pre></bdo></b><th id='jTaWQ'></th></span></q></dt></tr></i><div id='jTaWQ'><tfoot id='jTaWQ'></tfoot><dl id='jTaWQ'><fieldset id='jTaWQ'></fieldset></dl></div>
  1. <small id='jTaWQ'></small><noframes id='jTaWQ'>

    • <bdo id='jTaWQ'></bdo><ul id='jTaWQ'></ul>

    <legend id='jTaWQ'><style id='jTaWQ'><dir id='jTaWQ'><q id='jTaWQ'></q></dir></style></legend><tfoot id='jTaWQ'></tfoot>

      PHP:运行预定作业(cron 作业)

      时间:2023-08-19
        • <bdo id='FUyA6'></bdo><ul id='FUyA6'></ul>

          <legend id='FUyA6'><style id='FUyA6'><dir id='FUyA6'><q id='FUyA6'></q></dir></style></legend>

          <small id='FUyA6'></small><noframes id='FUyA6'>

        • <i id='FUyA6'><tr id='FUyA6'><dt id='FUyA6'><q id='FUyA6'><span id='FUyA6'><b id='FUyA6'><form id='FUyA6'><ins id='FUyA6'></ins><ul id='FUyA6'></ul><sub id='FUyA6'></sub></form><legend id='FUyA6'></legend><bdo id='FUyA6'><pre id='FUyA6'><center id='FUyA6'></center></pre></bdo></b><th id='FUyA6'></th></span></q></dt></tr></i><div id='FUyA6'><tfoot id='FUyA6'></tfoot><dl id='FUyA6'><fieldset id='FUyA6'></fieldset></dl></div>
            <tfoot id='FUyA6'></tfoot>

                <tbody id='FUyA6'></tbody>

                本文介绍了PHP:运行预定作业(cron 作业)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我的 webhotel 上有一个站点,我想在其上运行一些计划任务.您会推荐哪些方法来实现这一目标?

                I have a site on my webhotel I would like to run some scheduled tasks on. What methods of achieving this would you recommend?

                到目前为止,我想到的是在每个页面的顶部包含一个脚本,然后让该脚本检查是否该运行该作业.

                What I’ve thought out so far is having a script included in the top of every page and then let this script check whether it’s time to run this job or not.

                这只是我所想的一个简单例子:

                This is just a quick example of what I was thinking about:

                if ($alreadyDone == 0 && time() > $timeToRunMaintainance) {
                   runTask();
                   $timeToRunMaintainance = time() + $interval;
                } 
                

                还有什么我应该考虑的吗?还有比这更好的方法吗?

                Anything else I should take into consideration or is there a better method than this?

                推荐答案

                这就是 cronjobs 的用途.man crontab 假设您正在运行 Linux 服务器.如果您没有 shell 访问权限或无法设置 cronjobs,可以使用免费服务在外部服务器上设置 cronjobs 并 ping 您的 URL 之一.

                That's what cronjobs are made for. man crontab assuming you are running a linux server. If you don't have shell access or no way to setup cronjobs, there are free services that setup cronjobs on external servers and ping one of your URLs.

                这篇关于PHP:运行预定作业(cron 作业)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:在 MySQL 中获取未提交的数据 下一篇:使用 CPanel 在 cron 作业中运行 PHP 文件

                相关文章

                <i id='Auvnc'><tr id='Auvnc'><dt id='Auvnc'><q id='Auvnc'><span id='Auvnc'><b id='Auvnc'><form id='Auvnc'><ins id='Auvnc'></ins><ul id='Auvnc'></ul><sub id='Auvnc'></sub></form><legend id='Auvnc'></legend><bdo id='Auvnc'><pre id='Auvnc'><center id='Auvnc'></center></pre></bdo></b><th id='Auvnc'></th></span></q></dt></tr></i><div id='Auvnc'><tfoot id='Auvnc'></tfoot><dl id='Auvnc'><fieldset id='Auvnc'></fieldset></dl></div>

                <tfoot id='Auvnc'></tfoot>

                  <small id='Auvnc'></small><noframes id='Auvnc'>

                    <bdo id='Auvnc'></bdo><ul id='Auvnc'></ul>

                    <legend id='Auvnc'><style id='Auvnc'><dir id='Auvnc'><q id='Auvnc'></q></dir></style></legend>