Home > Backend Development > PHP Tutorial > Discuz method to replace post content in batches (using SQL to update the database)_PHP tutorial

Discuz method to replace post content in batches (using SQL to update the database)_PHP tutorial

WBOY
Release: 2016-07-13 10:24:11
Original
1059 people have browsed it

Today, a friend's Discuz X2 forum needed to replace the content of posts in batches. The number of posts was tens of thousands. At first, I set up word filtering, but found that it had no effect. I could only replace it in batches through the database. Please read below for the specific method.

Discuz X2 forum backend provides the function of database SQL statement operation, but by default for security reasons, this function is turned off, so you must first modify the configuration file. The method is as follows:

Find the forum program file config/config_global.php, open the file with Notepad, then search for $_config['security']['querysafe']['status'] and set it to 0, continue to search for $_config[ 'admincp']['runquery'] just set it to 1. (For security reasons, it is recommended to change the values ​​of these two parameters back after executing the SQL statement)

Here’s how to batch modify post content in Discuz X2:

1. Enter Discuz X2 backend → Webmaster → Database → Upgrade

2. Enter the following statement and submit:

Copy code The code is as follows:

UPDATE pre_forum_post SET message=REPLACE(message,""Content to be replaced"",""New content"");

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/825527.htmlTechArticleToday, a friend’s Discuz X2 forum needed to replace the content of posts in batches. The number of posts was tens of thousands. At the beginning, it was set up Word filtering found no effect and can only be replaced in batches through the database...
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