创建文件“/plus/dl.php”,代码:
<?php /******************* * 说明:根据文档ID下载其“本地下载” * 作者:巷(upall),http://upall.cn/ * 日期:2011-07-14 *******************/ require_once(dirname(__FILE__)."/../member/config.php"); require_once(dirname(__FILE__).'/../include/common.inc.php'); $id = (int)$_GET['aid']; $sql = "SELECT softlinks FROM site_addonsoft WHERE aid = '$id' LIMIT 1"; $rs = $dsql->GetOne($sql); $links = $rs['softlinks']; $linkArray = preg_split("/{*}/",$links,-1,PREG_SPLIT_DELIM_CAPTURE); if (empty($linkArray[1])){ showMsg('此软件暂不提供下载','-1'); exit; }else{ $softUrl = $linkArray[1] = trim(substr($linkArray[1],0,-11)); header("location:{$softUrl}"); exit; } ?>
模板代码:
<ul class="articleList"> {dede:arclist titlelen='80' flag='c' typeid='12' row=4} <li><a href="/plus/dl.php?aid=[field:id /]" title="点击下载:[field:title /]">[field:title /]</a></li> {/dede:arclist} </ul>
<完>