Laravel 创建定时任务
官方文档给出的教程已经很详细了,这里给出一些补充帮助大家理解。
英文文档:https://learnku.com/docs/laravel/5.2/scheduling
中文文档:https://learnku.com/docs/laravel/5.2/sched...
Starting The Scheduler
这里文档说的很简单,就是让你在服务器的crontab加入一条命令。
* * * * * php /path/to/artisan schedule:run >> /dev/null 2>&1
关于crontab可以参考这篇文章:http://www.cnblogs.com/xxoome/p/6091459.ht...
这条命令什么意思呢?按照crontab配置文件格式的解释
红框内都是shell命令。
php:/usr/local/php/bin/php // 如果配有配置php的全局环境变量,这里需要指定php的绝对路径。
artisan:/home/prj-test/test/artisan // 就是你项目根目录下的artisan文件的绝对路径
例如:
* * * * * /usr/local/php/bin/php /home/prj-test/test/artisan schedule:run >> /dev/null 2>&1
详情请参考我的博客:http://www.cnblogs.com/xxoome/p/6092961.ht...
这个编辑器不太习惯。。