[英]How to use cron job on localhost in Windows with Laravel 5
I found this post here : Run Cron Job on PHP Script, on localhost in Windows which is working perfectly. 我在这里找到了这篇文章: 在PHP脚本上运行Cron Job,在Windows的localhost上运行良好。 Instead of a PHP file I want to run an URL instead, like http://localhost/test-cron-job
我要运行一个URL,而不是PHP文件,例如http:// localhost / test-cron-job
I tried to simply change this line here: 我试图在这里简单地更改这一行:
"C:\xampp\php\php.exe" -f "C:\Users\Matthew\Documents\Work\cronjob\my_script.php"
to this: 对此:
"C:\xampp\php\php.exe" -f "http://localhost/test-cron-job"
But it is not working at all. 但这根本没有用。 What can I do to make this work?
我该怎么做才能使这项工作?
It doesn't work because php.exe
is supposed to execute a PHP file. 它不起作用,因为
php.exe
应该执行PHP文件。 When you point it to a URL it doesn't know what to do. 当您将其指向URL时,它不知道该怎么做。
What you need is something like curl for Windows and then you can make a HTTP request: 您需要的是类似Windows的curl ,然后可以发出HTTP请求:
curl http://localhost/test-cron-job
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.