Discuz批量替换帖子内容的方法(使用SQL更新数据库)_php实例

WBOY
Release: 2016-06-07 17:18:21
Original
818 people have browsed it

今天一个朋友的Discuz X2论坛需要批量替换帖子的内容,帖子数量上万,一开始是通过设置词语过滤,发现无效果,只能通过数据库批量替换了,具体方法请接着往下看。

Discuz X2论坛后台提供数据库SQL语句操作的功能,但是默认情况下出于安全考虑,该功能是被关闭的,所以得先修改下配置文件,方法如下:

找到论坛程序文件config/config_global.php,用记事本打开该文件,然后查找$_config['security']['querysafe']['status']将其设置为0,继续查找$_config['admincp']['runquery']将其设置为1即可。(出于安全考虑,建议执行SQL语句完毕后将这两个参数的值再改回来)

下面教大家Discuz X2批量修改帖子内容的方法:

1.进入Discuz X2后台→站长→数据库→升级

2.输入如下语句后提交即可:

复制代码 代码如下:

UPDATE pre_forum_post SET message=REPLACE(message,""要替换的内容"",""新内容"");
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!