其他分享
首页 > 其他分享> > dedecms v5.7搜索无法识别大写字母的解决方法

dedecms v5.7搜索无法识别大写字母的解决方法

作者:互联网

我们在使用dedecms v5.7进行英文搜索的时候,发现如果输入的是大写字母,dedecms将自动过虑掉,而只搜索小写的字母和数字,所以往往对于得到的搜索结果不是很令人满意,纠其原因发现dedecms中/include/helpers/filter.helper.php文件中正式表达式没有添加A-Z的规则,立即动手来解决这个小Bug吧!

例如:我们搜索“Dede58”,但搜索结果中只保留了“ede58”,过滤掉大写字母的截图如下:

 

首先下载你的/include/helpers/filter.helper.php文件到本地电脑,并用编辑器打开,找到程序的第169行,代码如下:


  1. if(preg_match("/[^0-9a-z@#\.]/",$keyword[$i])) 

将其修改为:https://www.cqxftyyj.com


  1. if(preg_match("/[^0-9a-zA-Z@#\.]/",$keyword[$i])) 

标签:大写字母,helper,preg,dedecms,v5.7,搜索,filter
来源: https://www.cnblogs.com/zqw111/p/12918475.html