crx349 發表於 2019-5-31 17:06:27

升级Discuz!X3.4版后特殊字符 乱码解决方案

<font color="#4f4f4f"><font face="&amp;quot;"><font style="font-size:16px">Discuz!3.4升级后,贴子内容使用Unicode编码会出现直接显示源码问题</font></font></font><br /><font color="#4f4f4f"><font face="&amp;quot;"><font style="font-size:16px">打开:source\function\function_core.php</font></font></font><br /><font color="#4f4f4f"><font face="&amp;quot;"><font style="font-size:16px">解决办法</font></font></font><br /><font color="#4f4f4f"><font face="&amp;quot;"><font style="font-size:16px"><br /></font></font></font><br />搜索<br /><ol><li>$string = str_replace(array('&amp;', '&quot;', '&lt;', '&gt;'), array('&amp;', '&quot;', '&lt;', '&gt;'), $string);</ol><br />下面加入<br /><ol><li>if(strpos($string, '&amp;#') !== false) {<br /><li>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; $string = preg_replace('/&amp;((#(\d{3,5}|x{4}));)/', '&amp;\\1', $string);<br /><li>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;}</ol><br /><br /><br /><br /><br />4f4f4f<em>, </em>quot<em>, </em>16px

a3303eaa 發表於 2019-5-31 17:49:35

谢谢分享!!

xzaxza 發表於 2019-6-1 09:13:04

好东西&nbsp;&nbsp;谢谢分享

耗子 發表於 2019-6-3 13:37:55

感谢大神分享

站长 發表於 2019-6-16 15:38:10

收藏一下了

wikipup 發表於 2019-6-16 16:25:08

<br /><br />试试看,刚升级上来

星点互联 發表於 2019-6-18 11:10:28

来看看,学习了

Lincoln 發表於 2019-6-19 04:20:59

好东西,谢谢分享不错。

cqzg2006lyy 發表於 2019-6-19 18:26:04

为什么我搜不到这句?只能搜到:$string = str_replace(array('&amp;', '&quot;', '&lt;', '&gt;'), array('&amp;amp;', '&amp;quot;', '&amp;lt;', '&amp;gt;'), $string);<br /><br />前半段一样,后半段不一样。

静观对月 發表於 2019-6-24 15:20:04

谢谢分享
頁: [1]
查看完整版本: 升级Discuz!X3.4版后特殊字符 乱码解决方案