<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、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                ## 接入 `think-orm` >[danger] 只能在 **常駐同步模式** 接入,無法在 **常駐協程模式** 使用,因為 think-orm 的代碼里使用了大量的全局變量,在協程中存在全局變量污染的問題。 1. 使用 composer 安裝 `think-orm`: ``` composer require topthink/think-orm ``` 2. 新增 `apps\common\libraries\ThinkOrmInitialize` 類: ```php <?php namespace apps\common\libraries; /** * Class ThinkOrmInitialize * @package apps\common\libraries */ class ThinkOrmInitialize { public static function handle() { $dsn = self::parseDSN(env('DB.DSN')); // 數據庫配置信息設置 $config = [ // 數據庫類型 'type' => $dsn['type'], // 服務器地址 'hostname' => $dsn['host'], // 數據庫名 'database' => $dsn['dbname'], // 數據庫用戶名 'username' => env('DB.USERNAME'), // 數據庫密碼 'password' => env('DB.PASSWORD'), // 數據庫連接端口 'hostport' => $dsn['port'], // 數據庫連接參數 'params' => [], // 數據庫編碼默認采用utf8 'charset' => $dsn['charset'], // 數據庫表前綴 'prefix' => 'think_', ]; \think\Db::setConfig($config); } public static function parseDSN($dsn) { $type = strstr($dsn, ':', true); parse_str(str_replace(';', '&', substr(strstr($dsn, ':'), 1)), $data); return ['type' => $type] + $data; } } ``` 3. 在當前應用配置文件中增加 `initialize` 配置項: ```php // 初始化回調 'initialize' => ['apps\common\libraries\ThinkOrmInitialize::handle'], ``` 接下來就可以正常在代碼中使用 `think-orm` 了。 ### 官方文檔 - http://www.hmoore.net/manual/thinkphp5_1/353998 - https://github.com/top-think/think-orm
                  <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>

                              哎呀哎呀视频在线观看