• <dl id="2u8ki"><small id="2u8ki"></small></dl>
    • <rt id="2u8ki"><em id="2u8ki"></em></rt>
    • <menu id="2u8ki"></menu>
      0712-2888027 189-8648-0214
      微信公眾號

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

      當前位置:主頁 > 技術(shù)支持 > PHPCMS > phpcms在下載內(nèi)容頁直接下載文件并帶有下載次數(shù)

      phpcms在下載內(nèi)容頁直接下載文件并帶有下載次數(shù)

      時間:2015-11-11來源:風信官網(wǎng) 點擊: 911次

      方法一:

      一、識別
      識別出系統(tǒng)默認模板方案的兩個文件:
      default/phpcms/show_down.html
      default/phpcms/down.html

      二、操作
      下載模型里面使用“下載列表”字段就可以,禁止掉“下載地址”字段。

      1、修改show_down.html模板
      <h3>下載地址</h3>
      <div id="down_address">
      {$downurl}
      {$downurls}
      </div>

      變成:

      <h3>下載地址</h3>
      <script type="text/javascript">
      $(function(){
      $.get('{$downurls}',function(data){
      $('#down_address').html(data);
      });
      });
      </script>
      <div id="down_address"></div>

      或者
      <h3>下載地址</h3>
      <script type="text/javascript">
      var xmlhttp;
      if(window.XMLHttpRequest){
      xmlhttp=new XMLHttpRequest();
      }else{
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
      xmlhttp.onreadystatechange=function(){
      if(xmlhttp.readyState==4 && xmlhttp.status==200){
      document.getElementById("down_address").innerHTML=xmlhttp.responseText;
      }
      }
      xmlhttp.open("GET","{$downurls}",true);
      xmlhttp.send();
      </script>
      <div id="down_address"></div>

      說明:沒有引用JQuery時就用這種方式。

      2、修改down.html模板
      注釋掉整模板內(nèi)容,在文件末尾并加入一段代碼。
      <?php
      /*
      注釋模板內(nèi)容而不刪除,目的就是盡量保持系統(tǒng)原有的內(nèi)容,以便日后使用或修改。
      */
      ?>
      <a href="http://lanfeng898.blog.163.com/blog/{$downurl}">{$head[title]}</a>
      //{$head[title]}是標題名,可以自定義下載名稱,如:高速下載、快速下載等等。

      方法二:

      在down.html頁面它的<meta>里面改成或者添加
      <meta http-equiv="refresh" content="0;URL={$downurl}" />

      在<body>里面加入

      <script type="text/javascript">
      //<!--
      function isIFrameSelf(){try{if(window.top ==window){return false;}else{return true;}}catch(e){return true;}}
      function toHome(){ if(!isIFrameSelf()){ window.location.href="/index.php";}window.close();}
      window.setTimeout("toHome()",5000);
      //-->
      </script>

      讓其在5秒內(nèi)關(guān)閉窗口

      欄目列表
      推薦內(nèi)容
      熱點內(nèi)容
      展開
      中文字幕无码AV黄片,亚洲天堂日本美女,国产亚洲色婷婷久久99精品91,午夜无码不卡视频 99久色图精品国产 精品熟女少妇A∨免费久久
    • <dl id="2u8ki"><small id="2u8ki"></small></dl>
      • <rt id="2u8ki"><em id="2u8ki"></em></rt>
      • <menu id="2u8ki"></menu>