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

      <tfoot id='4cjDo'></tfoot>

      <small id='4cjDo'></small><noframes id='4cjDo'>

    1. <legend id='4cjDo'><style id='4cjDo'><dir id='4cjDo'><q id='4cjDo'></q></dir></style></legend>

      在 Windows 本地主机上的 PHP 脚本上运行 Cron 作业

      时间:2023-08-19

        <tbody id='OBp1p'></tbody>
      • <bdo id='OBp1p'></bdo><ul id='OBp1p'></ul>
        <legend id='OBp1p'><style id='OBp1p'><dir id='OBp1p'><q id='OBp1p'></q></dir></style></legend>

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

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

                <tfoot id='OBp1p'></tfoot>

                本文介绍了在 Windows 本地主机上的 PHP 脚本上运行 Cron 作业的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我有一个 php 脚本,想按计划运行它.我在 Windows 上使用本地 Web 服务器(WAMP 服务器)并且需要一种方法来运行 my_script.php 每 10 分钟.

                I have a php script and want to run it on an schedule. I am using local web server on windows (WAMP server) and need a way to run my_script.php every 10 min.

                如何在 Windows 本地主机上的 PHP 脚本上运行 cron 作业?

                How to run a cron job on a PHP script, on localhost in windows?

                推荐答案

                最近我在 Windows 7 的 localhost(WAMP 服务器)上的 php 脚本上运行 cron 作业时遇到了一些问题,当时我正在接受长期测试从 www 那里获取一些链接.

                recently I had sort of problems to run a cron job on a php script on localhost (WAMP server) in windows 7, when I was on a test to chronically fetch some links from www out there.

                顺便说一下,我将与任何有相同想法的人分享这个.

                By the way I am sharing this for anyone that is on the same thing.

                您需要一个 shellscript 来长期运行,使用 Windows 任务计划程序.此外,您还需要一个批处理脚本 (script.bat) 来调用 php.exe 并运行您的 php 脚本(此处称为 my_process.php)

                You will need a shellscript to run chronically, using Windows Task Scheduler. Also you will need a batch script (script.bat) to call the php.exe and run your php script (here called as my_process.php)

                shellscript.vbs

                Set WinScriptHost = CreateObject("WScript.Shell")
                WinScriptHost.Run Chr(34) & "C:path	oscriptscript.bat" & Chr(34), 0
                Set WinScriptHost = Nothing
                

                script.bat

                "C:wampinphpphp5.4.12php.exe" -f "C:wampwwwwebsitemy_process.php"
                

                现在,我们已准备好设置 Windows 任务计划程序 以在所需的时间间隔运行 shellscript.vbs:

                Now, we are ready to set the Windows Task Scheduler to run shellscript.vbs at the required time interval:

                1. 从窗口开始菜单中打开任务计划
                2. 转到操作菜单并点击创建任务...
                3. 常规标签中,根据需要填写名称描述字段
                4. 触发器标签中,点击新建按钮.
                5. 开始任务下拉菜单中,选择按计划并选择每天
                6. 高级设置部分,根据需要选择重复任务时间并将持续时间设置为无限期.
                7. 操作标签上,从操作下拉菜单中选择启动程序.
                8. Programscript框中,输入shellscript.vbs的路径,如C:path oshellscript.vbs.
                9. 添加参数(可选)部分留空.
                10. Start in (optional)框中,输入shellscript.vbs的父目录,如C:path o.
                11. 对本教程点赞 :) 玩得开心.
                1. Open Task Scheduler from windows Start menu
                2. Go to Action menu and hit Create Task...
                3. in General tab, fill the Name and Description fields as you want
                4. in Triggers tab, hit New button.
                5. from Begin the Task dropdown, select On a schedule and choose Daily
                6. from Advanced settings section, select Repeat task every as you want and set for a duration on Indefinitely.
                7. on Actions tab, from Action dropdown, select Start a program.
                8. on the Programscript box, enter path to shellscript.vbs like C:path oshellscript.vbs.
                9. leave Add argumentts (optional) section empty.
                10. in Start in (optional) box, enter parent directory of shellscript.vbs like C:path o.
                11. Hit upvote on this tutorial :) Have fun.

                这篇关于在 Windows 本地主机上的 PHP 脚本上运行 Cron 作业的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:为什么 crontab 不执行我的 PHP 脚本? 下一篇:bash.sh 拒绝运行 cron 的权限

                相关文章

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

              1. <legend id='OLUIX'><style id='OLUIX'><dir id='OLUIX'><q id='OLUIX'></q></dir></style></legend>

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