[英]Running Artisan Command from laravel 4.2 Controller
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
. php artisan MuCustomCommand from CLI
。
I have registered command in app/start/artisan.php.
我在app/start/artisan.php.
注册了命令app/start/artisan.php.
Even Artisan::call('php artisan --help');
甚至Artisan::call('php artisan --help');
is not working. 不管用。
You should run artisan command like this from your controller . 你应该从你的控制器运行这样的artisan命令。 Example : 示例:
Artisan::call('migrate:install');
So Instead of doing Artisan::call('php artisan MyCustomCommand');
所以不要做Artisan::call('php artisan MyCustomCommand');
You should do 你应该做
Artisan::call('MyCustomCommand');
Here is the documentation 这是文档
Hope it helps :) 希望能帮助到你 :)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.