Chinese display garbled characters problem
杨一鸣
杨一鸣 2018-08-05 22:50:52
0
2
1329

I just started learning PHP, configured apache2.4 php7, and wrote a few lines with Notepad

<?PHP

echo "Welcome to PHP!";

?>

When opened with IE and Google, Chinese characters are displayed as garbled characters. . . I haven't been able to find the answer for a whole day. . Seeking experts. .


杨一鸣
杨一鸣

reply all(2)
笨笨

Need to add at the top of the PHP file: header('Content-type:text/html;charset=utf-8');

  • reply Well, I later added this header("content-type:text/html;charset=GB2312"); and it worked. I tried again and changed charset=GB2312 to charset=utf-8, but it was still garbled. I still have some problems with this encoding. Confused, check some more information.
    杨一鸣 author 2018-08-06 14:45:46

Try adding a sentence before the output: header("Content-type:text/html;charset=utf-8");

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template