在瀏覽版面時有出現亂碼的困擾嗎??
那是因為..使用者輸入完資料存入資料庫時..
會把日文及簡體中文轉換成 그 編碼
但是..同樣的字..在資料庫 l2play_posts_text 的 post_subject 和 post_text 二個欄位卻有不同的形式
post_text 的欄位會轉成 그 <-- 顯示正常
但是..
post_subject 的欄位會變成 &#44536; <-- 顯示亂碼\r
看出來了嗎...
多出了 amp; 的字符...
翻了之前大大po過的一些文章..修改方式都太麻煩了..
小弟提供一個快速的方法...整個過程不到3分鐘...
不需動到資料庫..只用 ereg_replace 的指令..
將 amp; 字符取代為 空白 ...
這樣一來顯示就正常了..
=開啟viewtopic.php
===尋找\r
代碼: 選擇全部
$post_subject = preg_replace($orig_word, $replacement_word, $post_subject);
代碼: 選擇全部
[b]$post_subject = ereg_replace("[/b][b]&[/b][b]amp;[/b][b]#","&#",$post_subject);[/b]
代碼: 選擇全部
$topic_title = preg_replace($orig_word, $replacement_word, $topic_title);
代碼: 選擇全部
[b]$topic_title = ereg_replace("[/b][b]&[/b][b]amp;[/b][b]#","&#",$topic_title);[/b]
=開啟viewforum.php
===尋找\r
代碼: 選擇全部
$topic_title = ( count($orig_word) ) ? preg_replace($orig_word, $replacement_word, $topic_rowset[$i]['topic_title']) : $topic_rowset[$i]['topic_title'];
代碼: 選擇全部
[b]$topic_title = ereg_replace("[/b][b]&[/b][b]amp;[/b][b]#","&#",$topic_title);[/b]
===尋找\r
===更改為\r"topic" => cutStr($rows['topic_title']),
代碼: 選擇全部
[b]"topic" => ereg_replace("[/b][b]&[/b][b]amp;[/b][b]#","&#",cutStr($rows['topic_title'])),[/b]
例如搜尋文章時用標題列表方式顯示...
當然您可以依照相同的模式加上程式碼即可解決...