phpcms v9在list_download.html页面中给图片加下载连接的方法
脚本之家
实现代码如下:
{pc:get sql="SELECT s.id,downfiles,title,inputtime FROM phpcms_download s,phpcms_download_data d WHERE s.id = d.id AND catid = $catid " page="$page" return="data"}
{loop $data $r}
{php $files = String2Array($r['downfiles'])}
{php $file = $files[0]['fileurl']}
{php $pc_auth_key = md5(pc_base::load_config('system','auth_key').$_SERVER['HTTP_USER_AGENT']);}
{php $a_k =urlencode(sys_auth("i=$r[id]&d=1&s=&t=".SYS_TIME."&ip=".ip()."&m=1&f=$file&modelid=".$modelid, 'ENCODE', $pc_auth_key));}
<a href="?m=content&c=down&a=download&a_k={$a_k}" title="点击下载文件"><img src="{IMG_PATH}bdxz_btn.jpg" width="103" height="29" alt="点击下载" id="imageButton"/></a>
{/loop}
{/pc}
{pc:get sql="SELECT s.id,downfiles,title,inputtime FROM phpcms_download s,phpcms_download_data d WHERE s.id = d.id AND catid = $catid " page="$page" return="data"}
{loop $data $r}
{php $files = String2Array($r['downfiles'])}
{php $file = $files[0]['fileurl']}
{php $pc_auth_key = md5(pc_base::load_config('system','auth_key').$_SERVER['HTTP_USER_AGENT']);}
{php $a_k =urlencode(sys_auth("i=$r[id]&d=1&s=&t=".SYS_TIME."&ip=".ip()."&m=1&f=$file&modelid=".$modelid, 'ENCODE', $pc_auth_key));}
<a href="?m=content&c=down&a=download&a_k={$a_k}" title="点击下载文件"><img src="{IMG_PATH}bdxz_btn.jpg" width="103" height="29" alt="点击下载" id="imageButton"/></a>
{/loop}
{/pc}