查看: 104|回覆: 0

[教程] PHPCMS V9采集地址中有相对路径的问题及解决方法

[複製鏈接]

3

主題

0

回帖

0

積分

热心网友

金币
0
閲讀權限
220
精華
0
威望
0
贡献
0
在線時間
0 小時
註冊時間
2008-5-5
發表於 2023-8-11 00:00:00 | 顯示全部樓層 |閲讀模式

修改数据库v9_collection_node,增加两个字段replace_from,replace_to(varchar(200)) 
1、 /phpcms/modules/collection/templates/node_form.tpl.php第99行后增加(位置在</table></fieldset>之前) 
<tr> 
<td width="120">网址替换:</td> 
<td> 
<input type="text" name="data[replace_from]" value="<?php if(isset($data['replace_from'])) echo $data['replace_from']?>"/>替换为 
<input type="text" name="data[replace_to]" value="<?php if(isset($data['replace_to'])) echo $data['replace_to']?>"/> 
</td> 
</tr> 
2、 /phpcms/modules/collection/classes/collection.class.php第177行后增加(位置在:$html = str_replace(array("</a>", "</A>"), "</a> ", $html);之后) 
if(!empty($config['replace_from'])){ 
$html = str_replace($config['replace_from'], $config['replace_to'], $html);} 
3、 进入数据库给 数据库名_collection_node 增加字段:replace_from 和 replace_to 两个字段。字数50-100都可以。 
然后在采集管理中我们能看到有替换网址的选项啦。将多余的../之类的替换掉就行了。

回覆

使用道具 舉報

您需要登錄後才可以回帖 登錄 | 立即注册

本版積分規則

相关侵权、举报、投诉及建议等,请发 E-mail:qiongdian@foxmail.com

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部