<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                我們在命令行中經常會用php artisan 命令,我們也可以自定義 首先我們創建 `php artisan make:command ShowGreet` 在 `app\console\commands\` 下面有這個文件ShowGreet.php然后我們編輯它 ~~~ //把執行方式protected $signature = 'command:name';這行改為 protected $signature = 'laravist:hello'; //然后下面有handle方法,我們編輯它 public function handle() { $this->info('hello my boby'); } ~~~ 這樣還不行我們要在 `App\Console\Kernel.php` 注冊它 ~~~ class Kernel extends ConsoleKernel { /** * The Artisan commands provided by your application. * * @var array */ protected $commands = [ \App\Console\Commands\Inspire::class, \App\Console\Commands\ShowGreet::class, ]; //---- ~~~ 然后我們在命令行中運行 `php artisan laravist:hello` 會輸出上面寫的 `hello my boby` 有時候我們輸php artisan 要帶參數我們可以這樣寫 在 `app\console\commands\ShowGreet.php` 中 ~~~ protected $signature = 'laravist:hello {name}'; public function handle() { //這邊的argument('name')就是上面的name $this->info('hello my boby '.$this->argument('name')); } ~~~ 如果想變量可有可無就加個 `?` 就可以了 ~~~ protected $signature = 'laravist:hello {name?}'; 如果想給個默認值就加個='默認值' 就可以了 protected $signature = 'laravist:hello {name=jdxia}'; ~~~ handle中還有很多其他的 比如顯示出來的提示可以有不同的顏色,本質上還是用了樣式 ~~~ public function handle() { $this->info('hello'); $this->error('hello'); $this->line("<info>hello</info>"); //綠色字體 } ~~~ 比如來一個滾動條 ~~~ public function handle() { $pb = $this->output->createProgressBar(100); //來不斷的讓他充滿 foreach (range(1,100) as $i) { $pb->advance(1); usleep(100000); } $pb->finish(); } ~~~ 還可以和控制臺做交互 ~~~ public function handle() { $words = $this->ask("say what?"); $this->line("say: $words"); } ~~~ 還可以做判斷 ~~~ public function handle() { if ($this->confirm("Yes or No")) { $words = "Yes"; } else { $words = "No"; } $this->line("say : $words"); } ~~~ 還可以做選擇 ~~~ public function handle() { $words = $this->choice("One or Two or Three", ['One', 'Two', 'Three']); $this->line("say: $words"); } ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看