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

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                昨天升級了一個隱藏的功能,今天就簡單的做個說明怎么用,反正也不能浪費不是 那就用內容頁面關鍵詞讀取相關內容為例吧。 前臺是你模型中已經存在`?keywords `字段? 關鍵詞支持 空格分割,號分割 那么就開始新功能之旅吧。 我們在?`application` 目錄中新建一個 api目錄 api目錄再新建一個 index 目錄 也就是`?application\api\index?` 下面新建一個`Keywords.php` ~~~ <?php namespace?app\api\index; /** ?*?動態獲取內容關鍵詞并讀取相關內容 ?*?Class?Keywords ?*?@package?app\api\index ?*/ class?Keywords{ public?function?index($text){ $cfg=unserialize($text['cfg']); ????????$biao=db($cfg['systype'].'_content')->where('id',$cfg['id'])->find();?//?查找這個內容的所在模型 $tags=db($cfg['systype'].'_content'.$biao['mid'])->where('id',$cfg['id'])->find();?//查找到模型后去模型表讀取這個內容的信息 $detail=strpos($tags['keywords'],',')!==false?explode(',',$tags['keywords']):explode('?',$tags['keywords']);?//根據這個信息的?keywords?字段進行拆分檢索?keywords?可以是自己定義的任意字段 $where=[]; $where_tit=[]; array_push($where_tit,'like'); $ARR=[]; for($i=0;$i<count($detail);$i++){ array_push($ARR,'%'.$detail[$i].'%'); } array_push($where_tit,$ARR); array_push($where_tit,'OR'); $where['title']=$where_tit; $array=db($cfg['systype'].'_content'.$biao['mid'])->where($where)->order($cfg['order'],$cfg['by'])->limit($cfg['rows'])->select(); foreach($array?AS?$k=>$rs){ $data[$k]['title']=$rs['title']; $data[$k]['create_time']=$rs['create_time']; $data[$k]['picurl']=tempdir($rs['picurl']); $rs['content']=preg_replace('/<([^<]*)>/is',"",$rs['content']); $data[$k]['content']=get_word($rs['content'],500); $data[$k]['url']=url($cfg['systype'].'/content/show',['id'=>$rs['id']],'html',true); } return?$data; } } ~~~ 臨時拼湊的代碼bug難免 僅僅是示例。 怎么使用呢? `template\index_style\default\cms\content\pc\_show.htm` 強烈建議自己復制default一份再改不然升級會覆蓋 在你需要的地方加上 ~~~ {qb:tag name="pc_show" rows="9" type="cms" union='id' class='app\\api\\index\\Keywords@index'} {$rs.title} {$rs.url} 內容網址 {$rs.title} 標題 {$rs.create\_time} 發布時間 {$rs.picurl}? 圖片 {$rs.content}? 內容 {/qb:tag} rows 調用數量 type 調用的模塊 你shop模塊就寫 =shop order 排序 ~~~ 是不是很好用 原理是union動態讀取內容的id根據內容id查找所在模型和內容并把keywords拆分 用他作為關鍵詞去查找內容。
                  <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>

                              哎呀哎呀视频在线观看