从Laravel 4.2 Controller运行Artisan Command [英] Running Artisan Command from laravel 4.2 Controller
问题描述
我正在尝试从
这样的控制器执行一些自定义工匠命令 Artisan::call('php artisan MyCustomCommand');
但是当我执行
时效果很好 php artisan MuCustomCommand from CLI
.
我已经在app/start/artisan.php.
中注册了命令
甚至Artisan::call('php artisan --help');
都不起作用.
您应该从控制器运行像这样的artisan命令. 例子:
Artisan::call('migrate:install');
所以不要做Artisan::call('php artisan MyCustomCommand');
您应该
Artisan::call('MyCustomCommand');
这是文档 >
希望它会有所帮助:)
I am trying to execute some custom artisan command from controller like
Artisan::call('php artisan MyCustomCommand');
but it works fine when I execute
php artisan MuCustomCommand from CLI
.
I have registered command in app/start/artisan.php.
Even Artisan::call('php artisan --help');
is not working.
You should run artisan command like this from your controller . Example :
Artisan::call('migrate:install');
So Instead of doing Artisan::call('php artisan MyCustomCommand');
You should do
Artisan::call('MyCustomCommand');
Here is the documentation
Hope it helps :)
这篇关于从Laravel 4.2 Controller运行Artisan Command的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!