本站资源均来自互联网,仅供学习与参考,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
Copyright @ 2015-2020 织梦园 版权所有
Power by DedeCms
鲁ICP备15039853号-1
鲁公网安备 37132302000249号
模板标签 TAG标签 网站地图 XML地图 今日更新 返回顶部
网站在替换关键的时候总是会出现错误,就像是dede和dede织梦网在替换的时候链接就会出现错误,所以想要一次性的替换所有的关键词就造成了很大的困难。
解决DedeCMS一次性替换所有文章关键词的具体方法:
打开include/arc.archives.class.php
在1226行代码,找到以下代码:
//高亮专用, 替换多次是可能不能达到***多次
function _highlight($string, $words, $result, $pre)
{
global $cfg_replace_num;
$string = str_replace('"', '"', $string);
后面增加一段代码,使它变为
//高亮专用, 替换多次是可能不能达到***多次
function _highlight($string, $words, $result, $pre)
{
global $cfg_replace_num;
$string = str_replace('"', '"', $string);
uasort($words,create_function('$a, $b','return strlen($a)>strlen($b);'));
这样就可以让关键词从字节比较小的开始替换,这样就不会出现上面说的替换错误了。