本文整理汇总了PHP中Illuminate\Console\Application::start方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::start方法的具体用法?PHP Application::start怎么用?PHP Application::start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Console\Application
的用法示例。
在下文中一共展示了Application::start方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getArtisan
/**
* Get the Artisan console instance.
*
* @return Illuminate\Console\Application
*/
protected function getArtisan()
{
if (!is_null($this->artisan)) {
return $this->artisan;
}
return $this->artisan = ConsoleApplication::start($this->app);
}
示例2: getArtisan
/**
* Get the Artisan console instance.
*
* @return \Illuminate\Console\Application
*/
protected function getArtisan()
{
if (!is_null($this->artisan)) {
return $this->artisan;
}
$this->app->loadDeferredProviders();
return $this->artisan = ConsoleApplication::start($this->app);
}
示例3: run
public function run()
{
if (!$this->checkUser()) {
echo '<p>' . Lang::get('web-artisan::webartisan.terminal.needlogin') . '</p>';
return;
}
$parts = explode(" ", Input::get('cmd'));
if (count($parts) < 2) {
echo '<p>' . Lang::get('web-artisan::webartisan.terminal.invalidcmd') . '</p>';
return;
}
//first is "artisan" so remove it
unset($parts[0]);
//second is the command
$cmd = $parts[1];
unset($parts[1]);
$app = app();
$app->loadDeferredProviders();
$artisan = ConsoleApplication::start($app);
$command = $artisan->find($cmd);
$def = $command->getDefinition();
$arguments = $def->getArguments();
$fix = array();
foreach ($arguments as $argument) {
$fix[] = $argument->getName();
}
$arguments = $fix;
$params = array();
//the rest should be the parameter list
$i = 0;
//The counter for our argument list
foreach ($parts as $param) {
// foo=bar, we don't need to work more
if (strpos($param, "=") !== false) {
$param = explode("=", $param, 2);
$params[$param[0]] = $param[1];
} else {
//Do we have an argument or an option?
if (substr($param, 0, 1) == "-") {
$params[$param] = true;
//Option, simply set it to true
} else {
//Argument, we need a bit work
$params[$arguments[$i]] = $param;
++$i;
}
}
}
$params['command'] = $cmd;
$input = new ArrayInput($params);
$command->run($input, new Output());
}
示例4: start
/**
* Create and boot a new Console application.
*
* @param \Illuminate\Foundation\Application $app
* @return \Illuminate\Console\Application
* @static
*/
public static function start($app)
{
return \Illuminate\Console\Application::start($app);
}