每天laravel-20160721|Application-1

來源:互聯網
上載者:User

標籤:laravel

namespace Illuminate\Console;use Illuminate\Contracts\Events\Dispatcher;use Illuminate\Contracts\Container\Container;use Symfony\Component\Console\Input\ArrayInput;use Symfony\Component\Console\Input\InputOption;use Symfony\Component\Console\Output\BufferedOutput;use Symfony\Component\Console\Application as SymfonyApplication;use Symfony\Component\Console\Command\Command as SymfonyCommand;use Illuminate\Contracts\Console\Application as ApplicationContract;// my name spaceclass Application extends SymfonyApplication implements ApplicationContract{// class Application extends SymfonyApplication implements ApplicationContract    /**     * The Laravel application instance.     *     * @var \Illuminate\Contracts\Container\Container     */    protected $laravel;// The laravel application instance.   // all use this instance in the    /**     * The output from the previous command.     *     * @var \Symfony\Component\Console\Output\BufferedOutput     */    protected $lastOutput;//The output from the previous command.// The previous command output String.    /**     * Create a new Artisan console application.     *     * @param  \Illuminate\Contracts\Container\Container  $laravel     * @param  \Illuminate\Contracts\Events\Dispatcher  $events     * @param  string  $version     * @return void     */    public function __construct(Container $laravel, Dispatcher $events, $version)    {        parent::__construct(‘Laravel Framework‘, $version);// use parents construct , may like set        $this->laravel = $laravel;// set the instance the laravel        $this->setAutoExit(false);// set the auto Exit        $this->setCatchExceptions(false);//set Catch Exceptions        $events->fire(new Events\ArtisanStarting($this));//fire the Events \Artisan Starting    }// Create a new Artisan console application    /**     * Run an Artisan console command by name.     *     * @param  string  $command     * @param  array  $parameters     * @return int     */ // Run an Artisan console command by name.    public function call($command, array $parameters = [])//Run an Artisan console command by name.    {// call $command array $parameters        $parameters = collect($parameters)->prepend($command);// collect($parameters)->prepend($command)      // set the parameters ,format the parameters.       // set parameter        $this->lastOutput = new BufferedOutput;// $this->lastOutput get the new Buffered Output        // the Output string is a Output class       // set the lastOutput        $this->setCatchExceptions(false);// set Catch Exceptions      // Set Catch Exceptions       // set the Exceptions        $result = $this->run(new ArrayInput($parameters->toArray()), $this->lastOutput);// run ()      // run the function use parameters and Output.        $this->setCatchExceptions(true);// set the Set Catch Exception        return $result;// back the result to the call    }    /**     * Get the output for the last run command.     *     * @return string     */    public function output()    {        return $this->lastOutput ? $this->lastOutput->fetch() : ‘‘;    }// Get the output for the last run command.   // return $this->lastOutput ? $this->lastOutput->fetch():


本文出自 “專註php” 部落格,請務必保留此出處http://jingshanls.blog.51cto.com/3357095/1765638

每天laravel-20160721|Application-1

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.