<blockquote id="15iad"><noscript id="15iad"><xmp id="15iad">
<td id="15iad"><strike id="15iad"></strike></td><track id="15iad"><strike id="15iad"><tt id="15iad"></tt></strike></track>

<table id="15iad"></table>

    1. 0712-2888027 189-8648-0214
      微信公眾號

      孝感風信網絡科技有限公司微信公眾號

      當前位置:主頁 > 技術支持 > PHPCMS > phpcms v9增加顯示下載次數功能

      phpcms v9增加顯示下載次數功能

      時間:2023-02-17來源:風信官網 點擊: 233次
      網上找的思路,還沒有經過實際的測試,可能會有Bug需相正,由于自己網站很下載有關系,就想顯示下載次數。研究了一下源碼發現數據庫沒這個字段,于是自己添加這個字段
       
      ALTER TABLE v9_download ADD `down_amount` int(10) unsigned NOT NULL DEFAULT '0'

      對于沒有生成靜態頁面的程序可以這么實現

      phpcms\modules\content\down.php
       
      //增加以下代碼--插入數據庫 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));


      然后是頁面輸出  

      phpcms\modules\content\index.php添加
       
      $r2 = $this->db->get_one(array('id'=>$id));
      $rs = $r2 ? array_merge($r,$r2) : $r;//PS:可以 print_r($rs)看看有沒需要的數據
       
      $data['down_amount']=$rs['down_amount']; //需要添加的代碼
       
       
      然后靜態頁面show_download.html
       
       
      輸出{$down_amount}
      熱門關鍵詞: phpcms 下載次數
      欄目列表
      推薦內容
      熱點內容
      展開
      96精品专区国产在线观看高清
      <blockquote id="15iad"><noscript id="15iad"><xmp id="15iad">
      <td id="15iad"><strike id="15iad"></strike></td><track id="15iad"><strike id="15iad"><tt id="15iad"></tt></strike></track>

      <table id="15iad"></table>