<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] ## 命名范圍 scope ``` namespace Home\Model; use Think\Model; class NewsModel extends Model { protected $_scope = array( 'normal'=>array( 'where'=>array('status'=>1), ), 'latest'=>array( 'order'=>'create_time DESC', 'limit'=>10, ), // 默認的命名范圍 'default'=>array( 'where'=>array('status'=>1), 'limit'=>10, ), ); } //調用 D("News")->scope('normal')->select(); //混合使用 $Model->scope('normal')->limit(8)->order('id desc')->select(); //支持屬性 //where , field , order , limit , page , having , group , lock , distinct , cache\ //支持連貫調用 $Model->scope('normal')->scope('latest')->select(); $Model->scope('normal,latest')->select(); //簡便操作,若沖突,則前面覆蓋后面 //默認調用 $Model->scope()->select(); ``` ## 視圖模型 關聯表 ``` 在模塊下的Model目錄 class ChannelViewModel extends ViewModel{ protected $viewFields=array( 'Channel'=>array('id','channel_name','token','_type'=>'RIGHT'), //right對應下表的 'Member'=>array('name','idcard','_on'=>'Channel.id=Member.channel_id') ); } 在控制器中調用 D("ChannelView")->where(array('id' => 47))->select() 以普通視圖一樣 ``` ## 數據庫操作 ## 設置數據庫緩存 在`config.php`中配置 `DATA_CACHE_TIME和DATA_CACHE_TYPE` ``` //不帶標識符 M('User')->where('id=5')->cache(true)->find(); //不帶標識符,帶過期時間 M('User')->where('id=5')->cache(true,60)->find(); /帶標識符 M('User')->cache('key',60)->find(); ``` ## 指定調用的模型 ``` D('Common/Dept'); D('Common/Dept','Logic'); //調用邏輯層 目錄結構為 Common/Logic/DeptLogic.class.php ```
                  <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>

                              哎呀哎呀视频在线观看