• <b id="l3qpx"><abbr id="l3qpx"></abbr></b>
  • <th id="l3qpx"><progress id="l3qpx"></progress></th>
      <th id="l3qpx"></th>
      <dd id="l3qpx"><font id="l3qpx"></font></dd>
      <th id="l3qpx"></th>
      0712-2888027 189-8648-0214
      微信公眾號(hào)

      孝感風(fēng)信網(wǎng)絡(luò)科技有限公司微信公眾號(hào)

      當(dāng)前位置:主頁(yè) > 技術(shù)支持 > PHPCMS > phpcms v9增加顯示下載次數(shù)功能

      phpcms v9增加顯示下載次數(shù)功能

      時(shí)間:2016-06-14來(lái)源:風(fēng)信官網(wǎng) 點(diǎn)擊: 674次
      網(wǎng)上找的思路,還沒(méi)有經(jīng)過(guò)實(shí)際的測(cè)試,可能會(huì)有Bug需相正,由于自己網(wǎng)站很下載有關(guān)系,就想顯示下載次數(shù)。研究了一下源碼發(fā)現(xiàn)數(shù)據(jù)庫(kù)沒(méi)這個(gè)字段,于是自己添加這個(gè)字段
       
      ALTER TABLE v9_download ADD `down_amount` int(10) unsigned NOT NULL DEFAULT '0'

      對(duì)于沒(méi)有生成靜態(tài)頁(yè)面的程序可以這么實(shí)現(xiàn)

      phpcms\modules\content\down.php
       
      //增加以下代碼--插入數(shù)據(jù)庫(kù) public function download() {}里面
       
      $var=explode("&",$a_k);
      $arr1=$var[0];
      $len=strlen($arr1);
      $end=$len-2;
      $id=substr($arr1,2,$end);
       
      $MODEL = getcache('model','commons');//獲取表名
      $tablename = $this->db->table_name = $this->db->db_tablepre.$MODEL[$modelid]['tablename'];//v9_download
       
       
      $rs=$this->db->get_one(array('id'=>$id));
      $down_amount=$rs['down_amount'];
       
      $sql = array('down_amount'=>$down_amount+1,);
      $this->db->update($sql, array('id'=>$id));


      然后是頁(yè)面輸出  

      phpcms\modules\content\index.php添加
       
      $r2 = $this->db->get_one(array('id'=>$id));
      $rs = $r2 ? array_merge($r,$r2) : $r;//PS:可以 print_r($rs)看看有沒(méi)需要的數(shù)據(jù)
       
      $data['down_amount']=$rs['down_amount']; //需要添加的代碼
       
       
      然后靜態(tài)頁(yè)面show_download.html
       
       
      輸出{$down_amount}
      熱門(mén)關(guān)鍵詞: phpcms 下載次數(shù)
      欄目列表
      推薦內(nèi)容
      熱點(diǎn)內(nèi)容
      展開(kāi)
      欧美一区二区三区免费A级视频,亚洲精品中文字幕综合,动漫精品中文字幕无码第一页,1024亚洲国产综合 亚太影院 柯西贝尔-游戏赚网
    1. <b id="l3qpx"><abbr id="l3qpx"></abbr></b>
    2. <th id="l3qpx"><progress id="l3qpx"></progress></th>
        <th id="l3qpx"></th>
        <dd id="l3qpx"><font id="l3qpx"></font></dd>
        <th id="l3qpx"></th>