
網頁出現亂碼的解決方法
有很多同學在剛學習網頁設計或是 PHP 時,會遇到網頁出現亂碼的問題。

這是因為我們網頁文件的編碼和瀏覽器的編碼不一樣的關係,要解決這個問題非常簡單,只要在網頁檔案裡設定編碼,且在存檔時,編碼格式也要和我們設定的一樣。
請將以下代碼寫到 <head> 標籤裡面:
<meta charset="utf-8">

文字編碼除了上面那個之外,還有種比較長的寫法如下:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
在儲存檔案時,編碼也要和上面設定的一樣,選擇「utf-8」。

最後重新整理瀏覽器,會發現網頁上的中文字已可正常顯示!

如果覺得文章內容還不錯的話,麻煩請幫我點個讚!感謝
可以多點幾次喔~~
第一次點讚需使用 Google 或 Facebook 帳號註冊

