首先在/include/extend.func.php增加以下方法:
/**
* 动态地址转静态输出 by Windchaser QQ:939238564
* $arcurl 动态网址
* @return String
*/
function arcurlHtml($arcurl){
preg_match('/view.php\?aid=(\d+)/',$arcurl,$arcid);
if(!empty($arcid) && is_array($arcid)){//匹配是否存在动态地址
global $dsql;
$addtable = $dsql->GetOne("SELECT channel.addtable FROM #@__channeltype AS channel LEFT JOIN #@__archives AS arc ON arc.channel=channel.id
WHERE arc.id='{$arcid}'");//获取模型类型表名
$redirecturl = $dsql->GetOne("SELECT redirecturl FROM {$addtable['addtable']} WHERE aid = '{$arcid}'");//动态获取表名,并查询redirecturl字段数据
if(!empty($redirecturl['redirecturl'])){
return $redirecturl['redirecturl'];//返回redirecturl字段数据
}else{
return $arcurl;
}
}else{//非动态地址直接返回原地址
return $arcurl;
}
}
页:
[1]