<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>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                ## 命令行:表格輸出 我們可以在命令中使用`table`方法以表格形式輸出數據。下面是一個`demo:table`閉包命令,它演示了`table`的用法: ~~~php Artisan::command('demo:table', function () { $headers = ['日期', '訂單數', '備注']; $orders = [ ['2019-05-20', '75'], ['2019-05-21', '80'], ['2019-05-22', '89'], ['2019-05-23', '91'], ['2019-05-24', '139', '促銷'] ]; $this->table($headers, $orders); })->describe('Demo table method'); ~~~ 只需傳入表頭和行數據給`table`方法,我們就可以獲得美觀的表格形式的數據輸出。 效果: [![表格輸出](https://cdn.learnku.com/uploads/images/201905/27/7636/0deG8SOL4l.png!large) 這是`table`方法的源碼(`vendor\laravel\framework\src\Illuminate\Console\Command.php`): ~~~php /** * Format input to textual table. * * @param array $headers * @param \Illuminate\Contracts\Support\Arrayable|array $rows * @param string $tableStyle * @param array $columnStyles * @return void */ public function table($headers, $rows, $tableStyle = 'default', array $columnStyles = []) { $table = new Table($this->output); if ($rows instanceof Arrayable) { $rows = $rows->toArray(); } $table->setHeaders((array) $headers)->setRows($rows)->setStyle($tableStyle); foreach ($columnStyles as $columnIndex => $columnStyle) { $table->setColumnStyle($columnIndex, $columnStyle); } $table->render(); } ~~~ 可以看到,`table`方法還支持表格樣式及各列數據樣式的定義,我們修改下上面的`demo:table`命令,讓用戶在執行命令時可選擇表格樣式: ~~~php Artisan::command('demo:table', function () { $headers = ['日期', '訂單數', '備注']; $orders = [ ['2019-05-20', '75'], ['2019-05-21', '80'], ['2019-05-22', '89'], ['2019-05-23', '91'], ['2019-05-24', '139', '促銷'] ]; $style = $this->choice( '請選擇表格樣式:', ['default', 'borderless', 'compact', 'symfony-style-guide', 'box', 'box-double'], 0 ); $this->table($headers, $orders, $style); })->describe('Demo table method'); ~~~ 效果: [![表格輸出](https://cdn.learnku.com/uploads/images/201905/27/7636/iNdDniFsf5.png!large) 注意:`box`和`box-double`樣式顯示中文數據可能會有錯位情況發生。
                  <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>

                              哎呀哎呀视频在线观看