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

时间:2021-05-02

修改数据库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]" style="width:250px" value="<?php if(isset($data['replace_from'])) echo $data['replace_from']?>"/>替换为
<input type="text" name="data[replace_to]" style="width:250px" 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都可以。
然后在采集管理中我们能看到有替换网址的选项啦。将多余的../之类的替换掉就行了。

声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。

相关文章