本文整理汇总了PHP中Illuminate\Console\Application::run方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::run方法的具体用法?PHP Application::run怎么用?PHP Application::run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Console\Application
的用法示例。
在下文中一共展示了Application::run方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: runCommand
/**
* Runs a command and returns it output
*
* @param \Symfony\Component\HttpKernel\Client $client
* @param $command
*
* @return string|\Symfony\Component\Console\Output\StreamOutput
*/
public function runCommand(Client $client, $command)
{
$application = new Application($client->getKernel());
$application->setAutoExit(false);
$fp = tmpfile();
$input = new StringInput($command);
$output = new StreamOutput($fp);
$application->run($input, $output);
fseek($fp, 0);
$output = '';
while (!feof($fp)) {
$output = fread($fp, 4096);
}
fclose($fp);
return $output;
}
示例2: run
/**
* Runs the current application.
*
* @param InputInterface $input An Input instance
* @param OutputInterface $output An Output instance
*
* @throws \Exception When doRun returns Exception
*
* @return int 0 if everything went fine, or an error code
*/
public function run(InputInterface $input = null, OutputInterface $output = null)
{
try {
return parent::run($input, $output);
} catch (Exception $e) {
if ($this->isAjax() === false) {
throw $e;
}
while ($prevException = $e->getPrevious()) {
$e = $prevException;
}
$this->renderException($e, $output);
return 1;
} catch (Throwable $e) {
if ($this->isAjax() === false) {
throw $e;
}
$e = new FatalThrowableError($e);
$this->renderException($e, $output);
return 1;
}
}
示例3: run
/**
* Runs the current application.
*
* @param \Symfony\Component\Console\InputInterface $input An Input instance
* @param \Symfony\Component\Console\OutputInterface $output An Output instance
* @return int 0 if everything went fine, or an error code
* @throws \Exception When doRun returns Exception
* @api
* @static
*/
public static function run($input = null, $output = null)
{
//Method inherited from \Symfony\Component\Console\Application
return \Illuminate\Console\Application::run($input, $output);
}
示例4: handle
/**
* Handle an incoming console command.
*
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Output\OutputInterface $output
*
* @return int
*/
public function handle($input, $output = null)
{
return $this->artisan->run($input, $output);
}