如何在 Windows 和 Laravel 5 的本地主机上使用 cron 作业
How to use cron job on localhost in Windows with Laravel 5
我在这里 post 找到了这个:Run Cron Job on PHP Script, on localhost in Windows which is working perfectly. Instead of a PHP file I want to run an URL instead, like http://localhost/test-cron-job
我试图在这里简单地更改这一行:
"C:\xampp\php\php.exe" -f "C:\Users\Matthew\Documents\Work\cronjob\my_script.php"
对此:
"C:\xampp\php\php.exe" -f "http://localhost/test-cron-job"
但它根本不起作用。我该怎么做才能完成这项工作?
它不起作用,因为 php.exe
应该执行 PHP 文件。当您将它指向 URL 时,它不知道该做什么。
你需要的是 curl for Windows 这样的东西,然后你可以发出 HTTP 请求:
curl http://localhost/test-cron-job
我在这里 post 找到了这个:Run Cron Job on PHP Script, on localhost in Windows which is working perfectly. Instead of a PHP file I want to run an URL instead, like http://localhost/test-cron-job
我试图在这里简单地更改这一行:
"C:\xampp\php\php.exe" -f "C:\Users\Matthew\Documents\Work\cronjob\my_script.php"
对此:
"C:\xampp\php\php.exe" -f "http://localhost/test-cron-job"
但它根本不起作用。我该怎么做才能完成这项工作?
它不起作用,因为 php.exe
应该执行 PHP 文件。当您将它指向 URL 时,它不知道该做什么。
你需要的是 curl for Windows 这样的东西,然后你可以发出 HTTP 请求:
curl http://localhost/test-cron-job