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

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                1,以為下方圖片為例,在api模塊下創建了一個command目錄,然后創建自己所需要的命令行執行文件 我的執行文件未Online.php ![](https://img.kancloud.cn/9b/c0/9bc0bc4cdd287c03a7eed01922337e03_474x117.png) 以下為代碼實例 ```php <?php namespace app\api\command; use think\console\Input; use think\console\input\Argument; use think\console\Output; use think\console\Command; /** * @package app\api\command */ class Online extends Command { /** * 配置指令 */ protected function configure() { $this->addArgument('task_id', Argument::OPTIONAL); $this->addArgument('sex', Argument::OPTIONAL); //此處為獲取執行命令的參數,并且定義參數key $this->setName('online:member')->setDescription('online member'); } protected function execute(Input $input, Output $output) { $args = $input->getArguments(); $task_id=$args['task_id']; $sex=$args['sex']; } } ``` > 代碼解讀 > 此處需要繼承thinkphp的command類,才能讓你的執行文件加載 > configure 為配置方法 > $this->addArgument('task_id', Argument::OPTIONAL);為獲取命令中的參數 > 比如 php think online:member 1 2 > 那么第一個 task_id=1 > 第二個 task_id=2 > execute 執行方法 > $args = $input->getArguments(); 獲取定義的參數 然后在application/你的模塊目錄下創建command.php 這些搞定后,找到thinkphp config目錄 ![](https://img.kancloud.cn/be/f6/bef610036f3a4e4f0a6b06b9d7231519_481x319.png) 直接 return你的命名空間即可使用了 ```php <?php // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN DO IT JUST THINK ] // +---------------------------------------------------------------------- // | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- // | Author: yunwuxin <448901948@qq.com> // +---------------------------------------------------------------------- return ['app\api\command\Online']; ``` 那么就讓我們來一起試一試吧
                  <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>

                              哎呀哎呀视频在线观看