duanlu4371
2013-11-17 07:04
浏览 47
已采纳

使用cron job在localhost上运行php脚本

I am trying to set up a cron job on my localhost to call a php script every half an hour 24/7. Following are my steps:

1) I have created a cron.php file to call myscript.php:

<?php

echo exec('*/30 * * * * C:\BitNami\wampstack-5.4.21-0\php -f C:\BitNami\wampstack-5.4.21-0\apache2\htdocs\myscript.php');

?>

2) Created a cron.bat file to run the cron.php on browser:

"C:\Program Files\Mozilla Firefox\firefox.exe" "localhost\cron.php"

3) Then I have set up a windows 7 task scheduler to call cron.bat every day.

I welcome any idea on how to set up a cron job as my approach doesn't do anything.

Thanks

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

3条回答 默认 最新

相关推荐 更多相似问题