找回密码
 立即注册
搜索

途迹耕耘

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

GMT+8, 2025-12-22 04:10 , Processed in 0.148790 second(s), 14 queries .

[DZ教程] Discuz 批量替换/修改门户文章标题、内容

[复制链接]
admin 发表于 2018-12-28 17:24:07 | 显示全部楼层 |阅读模式
  • 我们做论坛网站时,如果网站中需要替换或修改多个文章,就需要使用SQL批量操作。以前我们讲过DZ论坛批量修改已发布贴子内容,今天再来讲一下,Discuz 如何批量修改门户文章标题及内容。

    Discuz 批量替换/修改门户文章标题、内容 SQL命令:

    批量替换门户文章标题:

    UPDATE pre_portal_article_content SET content=REPLACE(subject,'替换前','替换后');

    批量替换门户文章内容:

    UPDATE pre_portal_article_content SET content=REPLACE(content,'替换前','替换后');

    批量替换论坛贴子标题:

    UPDATE pre_forum_thread SET subject=REPLACE(subject,'替换前,'替换后');

    批量替换论坛贴子内容:

    UPDATE pre_forum_post SET message=REPLACE(message,'替换前','替换后');

    举例:

    UPDATE pre_portal_article_content SET content=REPLACE(content,'<div><embed','<div><embed tt');
    UPDATE pre_portal_article_content SET content=REPLACE(content,'height="500">','height="tt500">');

    UPDATE pre_portal_article_content SET content=REPLACE(content,'<embed src=','<div><embed src=');
    UPDATE pre_portal_article_content SET content=REPLACE(content,'height="500">','height="500"></div><div>学做网站论坛https://www.xuewangzhan.com/</div>');

    UPDATE pre_portal_article_content SET content=REPLACE(content,'<div><embed tt','<div><embed');
    UPDATE pre_portal_article_content SET content=REPLACE(content,'height="tt500">','height="500">');

    提醒:在进行SQL批量操作前,不要忘记进行网站数据库备份。更多DISCUZ批量操作方法,请参考DISCUZ论坛常用批量修改SQL语句汇总