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

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                主表**不包含**外鍵,從表**包含** 外鍵 據關聯表的查詢條件查詢當前模型的數據,可以使用`hasWhere`方法 ~~~ $res5=\app\index\model\BannerItem::hasWhere('image',['path'=>'/public/img/3.jpg'])->select(); //sql:"SELECT `BannerItem`.* FROM `banner_item` `BannerItem` INNER JOIN `img` `Img` ON `BannerItem`.`img_id`=`Img`.`id` WHERE `Img`.`path` = '/public/img/3.jpg'" ~~~ 兩個表的條件都存在 ``` $res5=\app\index\model\BannerItem::hasWhere('image',['path'=>'/public/img/3.jpg'])->where(['banner_id'=>1])->select(); sql: "SELECT `BannerItem`.* FROM `banner_item` `BannerItem` INNER JOIN `img` `Img` ON `BannerItem`.`img_id`=`Img`.`id` WHERE `Img`.`path` = '/public/img/3.jpg' AND `banner_id` = 1" ``` `V5.0.3+`版本開始,可以指定關聯模型返回的字段,例如: 如果使用的是`join`方式的關聯,不支持指定field字段。(???) ~~~ namespace app\index\model; use think\Model; class User extends Model { public function userRelationProfile(){ return $this->hasOne('Profile'); } public function profile() { return $this->hasOne('Profile')->field('id,username,email');//只能指定profile里的字段,指定其他模型對應表的字段會報錯。 } } ~~~ 控制器: ``` $users1=\app\index\model\User::all([],'userRelationProfile'); $users2=\app\index\model\User::all([],'profile'); dump($users1->toArray()); dump($users2->toArray()); ``` 結果: ![](https://img.kancloud.cn/38/0f/380f969624622d808f44a940fe7b401c_426x446.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>

                              哎呀哎呀视频在线观看