[英]Run php artisan command in out of laravel project
I am writing an installer for laravel project. 我正在编写laravel项目的安装程序。
but for some reason, I don't run this installer from laravel project. 但是由于某种原因,我没有从laravel项目运行此安装程序。
I use PHP code. 我使用PHP代码。 I want to use
php artisan migrate
on my installer and I know that I can use this command system("php artisan migrate")
but I don't want to use system functions
on my installer. 我想在安装程序上使用
php artisan migrate
,我知道我可以使用此命令system("php artisan migrate")
但我不想在安装程序上使用system functions
。 Is there any way to artisan
command on PHP out of laravel? 有没有办法从laravel中在PHP上使用
artisan
命令?
Unfortunately artisan is baked into the Laravel Framework so your options are limited but you still have options. 不幸的是,工匠已经融入Laravel框架,因此您的选择有限,但您仍然可以选择。
You can use php's exec()
function. 您可以使用php的
exec()
函数。
http://php.net/manual/en/function.exec.php http://php.net/manual/en/function.exec.php
exec('php artisan migrate');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.