[laravel]使用命令行执行一些php功能

创建一个命令

php artisan make:command HashCommand

生成在 app/Console/Commands

具体命令在代码中:
protected $signature = 'command:name';

执行

php artisan command:name
php artisan tongbu 989 >> /home/tongbu.log

内容报错解决

找到对应版本PHP的配置文件php.ini
找到memory_limit = 128M ;
修改数值即可
memory_limit = 5120M ;

查看后台并终止

ps -ef |grep tongbu
kill xxxxx

查看日志

php /www/wwwroot/tongbu/artisan tongbu 1 1 1 1 1 1 1 1 1 > /home/log/tongbu_2021082101.log &
tail -20f /home/log/tongbu_2021082101.log

命令说明 后续的九个数分别为9个同步接口的起始页 后续可以添加 -A 选项 使得输出结果为所有信息,而并非错误信息

laravel wiki https://learnku.com/laravel/wikis/25712

猜你喜欢

转载自blog.csdn.net/JianShengShuaiest/article/details/119831078
今日推荐