利用Windows Schedule Task运行php程序

计划任务(Schedule Task)是windows平台上和cron类似的一个程序,当然功能上差了很多了。

因为需要每个小时运行一个PHP程序,手动操作不现实了。

首先在cmd下测试,例如: c:/appserv/php5/php.exe "C:/AppServ/www/temp2.php"

有一点要注意就是如果那个PHP引用了其他页面,需要提供绝对路径了,至少我的测试结果如此。

设置计划任务,可以利用Add Schedule Task的wizard。最后需要在高级设置里面Until: time设置为比你的开始时间早1分钟。

因为我在笔记本上测试,用了电池,把setting里面关于power management的去掉。

具体参考:

http://manual.b2evolution.net/Set_up_a_Windows_Scheduled_Task

http://sharpertutorials.com/windows-task-scheduler/

原文地址:https://www.cnblogs.com/ainima/p/6331366.html