汇客网络 发表于 2020-9-27 00:51:36

Discuz 批量替换内容(含标点符号)

<p style="padding-top: 10px; padding-bottom: 10px; word-break: break-all; text-indent: 2em; font-family: &quot;Microsoft Yahei&quot;, &quot;Hiragino Sans GB&quot;, &quot;Helvetica Neue&quot;, Helvetica, tahoma, arial, Verdana, sans-serif, &quot;WenQuanYi Micro Hei&quot;, 宋体; letter-spacing: 0.5px;"><font color="#000000">我们在使用Discuz 程序建网站时,往往需要对已发布的内容进行批量替换。这时我们可以使用Discuz 批量替换内容的方法。</font></p><p style="padding-top: 10px; padding-bottom: 10px; word-break: break-all; text-indent: 2em; font-family: &quot;Microsoft Yahei&quot;, &quot;Hiragino Sans GB&quot;, &quot;Helvetica Neue&quot;, Helvetica, tahoma, arial, Verdana, sans-serif, &quot;WenQuanYi Micro Hei&quot;, 宋体; letter-spacing: 0.5px;"><img alt="Discuz 批量替换内容" src="https://www.xuewangzhan.net/wp-content/uploads/2017/05/dz1.jpg" width="500px" style="margin: 10px auto; padding: 3px; border: 1px solid rgb(199, 191, 191); vertical-align: middle; display: block; max-width: 90%; height: auto;"></p><p style="padding-top: 10px; padding-bottom: 10px; word-break: break-all; text-indent: 2em; font-family: &quot;Microsoft Yahei&quot;, &quot;Hiragino Sans GB&quot;, &quot;Helvetica Neue&quot;, Helvetica, tahoma, arial, Verdana, sans-serif, &quot;WenQuanYi Micro Hei&quot;, 宋体; letter-spacing: 0.5px;"><strong><font color="#000000">Discuz 批量替换内容的SQL语句:</font></strong></p><p style="padding-top: 10px; padding-bottom: 10px; word-break: break-all; text-indent: 2em; font-family: &quot;Microsoft Yahei&quot;, &quot;Hiragino Sans GB&quot;, &quot;Helvetica Neue&quot;, Helvetica, tahoma, arial, Verdana, sans-serif, &quot;WenQuanYi Micro Hei&quot;, 宋体; letter-spacing: 0.5px;"><font color="#000000">批量替换论坛贴子标题:</font></p><pre style="white-space: normal; font-family: inherit; letter-spacing: 0.5px;"><div class="codecolorer-container text geshi" style="margin-top: 10px; margin-bottom: 10px; padding: 5px; background-color: rgb(253, 252, 252); border-width: 1px 1px 1px 5px; border-style: solid; border-color: rgb(243, 239, 239) rgb(243, 239, 239) rgb(243, 239, 239) rgb(108, 226, 108); border-image: initial; font-style: italic; overflow: auto; white-space: nowrap; width: 828px;"><div class="text codecolorer" style="line-height: 2em;"><font color="#000000">UPDATE pre_forum_thread SET subject=REPLACE(subject,'替换前','替换后');</font></div></div></pre><p style="padding-top: 10px; padding-bottom: 10px; word-break: break-all; text-indent: 2em; font-family: &quot;Microsoft Yahei&quot;, &quot;Hiragino Sans GB&quot;, &quot;Helvetica Neue&quot;, Helvetica, tahoma, arial, Verdana, sans-serif, &quot;WenQuanYi Micro Hei&quot;, 宋体; letter-spacing: 0.5px;"><font color="#000000">批量替换论坛贴子内容:</font></p><pre style="white-space: normal; font-family: inherit; letter-spacing: 0.5px;"><div class="codecolorer-container text geshi" style="margin-top: 10px; margin-bottom: 10px; padding: 5px; background-color: rgb(253, 252, 252); border-width: 1px 1px 1px 5px; border-style: solid; border-color: rgb(243, 239, 239) rgb(243, 239, 239) rgb(243, 239, 239) rgb(108, 226, 108); border-image: initial; font-style: italic; overflow: auto; white-space: nowrap; width: 828px;"><div class="text codecolorer" style="line-height: 2em;"><font color="#000000">UPDATE pre_forum_post SET message=REPLACE(message,'替换前','替换后');</font></div></div></pre><p style="padding-top: 10px; padding-bottom: 10px; word-break: break-all; text-indent: 2em; font-family: &quot;Microsoft Yahei&quot;, &quot;Hiragino Sans GB&quot;, &quot;Helvetica Neue&quot;, Helvetica, tahoma, arial, Verdana, sans-serif, &quot;WenQuanYi Micro Hei&quot;, 宋体; letter-spacing: 0.5px;"><font color="#000000">更多Discuz 批量替换内容SQL语句见:<span style="cursor: pointer;">Discuz 批量替换/修改门户文章标题、内容</span></font></p><p style="padding-top: 10px; padding-bottom: 10px; word-break: break-all; text-indent: 2em; font-family: &quot;Microsoft Yahei&quot;, &quot;Hiragino Sans GB&quot;, &quot;Helvetica Neue&quot;, Helvetica, tahoma, arial, Verdana, sans-serif, &quot;WenQuanYi Micro Hei&quot;, 宋体; letter-spacing: 0.5px;"><font color="#000000">这些批量替换语句没有问题,在我们学习<span style="cursor: pointer;">怎么建立网站</span>时,也可以正常使用。但有一个问题是:当我们替换的内容中有标点符号时,这些批量替换的语句就不能正常使用了。这时我们使用使用“反语义斜杠”来帮忙。</font></p><p style="padding-top: 10px; padding-bottom: 10px; word-break: break-all; text-indent: 2em; font-family: &quot;Microsoft Yahei&quot;, &quot;Hiragino Sans GB&quot;, &quot;Helvetica Neue&quot;, Helvetica, tahoma, arial, Verdana, sans-serif, &quot;WenQuanYi Micro Hei&quot;, 宋体; letter-spacing: 0.5px;"><font color="#000000"><strong>Discuz 批量替换</strong><strong>含标点符号的</strong>内容SQL语句:</font></p><pre style="white-space: normal; font-family: inherit; letter-spacing: 0.5px;"><div class="codecolorer-container text geshi" style="margin-top: 10px; margin-bottom: 10px; padding: 5px; background-color: rgb(253, 252, 252); border-width: 1px 1px 1px 5px; border-style: solid; border-color: rgb(243, 239, 239) rgb(243, 239, 239) rgb(243, 239, 239) rgb(108, 226, 108); border-image: initial; font-style: italic; overflow: auto; white-space: nowrap; width: 828px;"><div class="text codecolorer" style="line-height: 2em;"><font color="#000000">UPDATE pre_forum_post SET message=REPLACE(message,'/'http','/"http');</font></div></div></pre><p></p>
页: [1]
查看完整版本: Discuz 批量替换内容(含标点符号)