search
Homephp教程php手册Discuz批量替换帖子内容的方法(使用SQL更新数据库)

今天一个朋友的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,""要替换的内容"",""新内容"");

Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment