<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之旅 廣告
                [TOC] ### 組件說明 > Lying的數據庫連接使用的Connection組件,只支持Mysql(php和mysql就像薯條配番茄醬)。 ### 配置選項 | 配置名 | 參數類型 | 可選 | 默認值 | 說明 | | --- | --- | --- | --- | --- | | class | string | 是 | lying\db\Connection | 可配置 | | dsn | string | 是 | null | 數據庫dsn | | user | string | 是 | null | 數據庫賬號 | | pass | string | 是 | null | 數據庫密碼 | | options | array | 是 | [] | 額外的PDO選項 | | prefix | string | 是 | '' | 默認表前綴 | | cache | string | 是 | null | 緩存組件ID | | slave | array | 是 | [] | 從庫列表 | | master | array | 是 | [] | 主庫列表 | ### service配置 Lying的數據庫連接示例配置如下: ~~~php 'db' => [ 'class' => 'lying\db\Connection', 'dsn' => 'mysql:host=127.0.0.1;dbname=lying;charset=utf8', 'user' => 'root', 'pass' => 'root', 'options' => [], //額外的PDO參數 'prefix' => 'b_', //數據庫前綴 'cache' => false, //使用的緩存ID,設置為false則不使用緩存(緩存表結構) 'slave' => [ ['dsn' => 'mysql:host=127.0.0.1;dbname=lying;charset=utf8', 'user' => 'root', 'pass' => 'root'], ['dsn' => 'mysql:host=127.0.0.1;dbname=lying;charset=utf8', 'user' => 'root', 'pass' => 'root'], ['dsn' => 'mysql:host=127.0.0.1;dbname=lying;charset=utf8', 'user' => 'root', 'pass' => 'root'], ], 'master' => [ ], ], ~~~ ### 調用方式 ~~~php \Lying::$maker->get('db'); \Lying::$maker->db('dbId'); \Lying::$maker->db;` ~~~ ### 方法列表 db組件就是一個`lying\db\Connection`實例,其中class就是組件ID所對應的類名,并且`dsn`,`user`,`pass`都是必須的。 下面代碼將為你演示db的用法: ~~~php $db = \Lying::$maker->db; //獲取db組件實例 $db->masterPdo(); //獲取主庫PDO實例 $db->slavePdo(); //獲取從庫PDO實例 $db->begin(); //開始事務 $db->commit(); //提交事務 $db->rollBack(); //回滾事務 $db->lastInsertId(); //返回最后插入行的自增ID $db->prepare(); //預處理語句 $db->schema(); //獲取Schema實例 $db->query(); //創建查詢生成器 ~~~
                  <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>

                              哎呀哎呀视频在线观看