<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、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                ## 2.5 模型類 ~~~ 1. 創建一個模型類 2. 訪問模型 3. 模型訪問數據,并打印 ~~~ ### 1. 創建一個模型類 *D:\wamp\www\web.com\core\lib\model.php* ~~~ <?php namespace core\lib; class model extends \PDO { public function __construct() { $dsn = 'mysql:host=localhost;dbname=demo;charset=UTF8;'; $username = 'root'; $password = 'root'; try { parent::__construct($dsn, $username, $password); } catch (\Exception $e) { p($e->getMessage()); die; } } } ~~~ ### 2. 訪問模型 *D:\wamp\www\web.com\app\ctrl\indexCtrl.php* ~~~ <?php namespace app\ctrl; class indexCtrl { public function index() { $model = new \core\lib\model(); $sql = "SELECT * FROM `cat`"; p($model->query($sql)); } } ~~~ ### 3. 模型訪問數據,并打印 ~~~ <?php namespace app\ctrl; class indexCtrl { public function index() { $model = new \core\lib\model(); $sql = "SELECT * FROM `cat`"; $ret = $model->query($sql); p($ret); // foreach ($model->query($sql) as $key => $value) { // p($value); // } p($ret->fetchAll()); } } ~~~ > 備注:PDOStatement <http://php.net/manual/zh/class.pdostatement.php> ### 效果如圖 ![](https://box.kancloud.cn/63c0d569574b4f7c006989c429832e86_742x728.png)
                  <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>

                              哎呀哎呀视频在线观看