Home>Article>PHP Framework> What should I do if thinkphp outputs Chinese garbled characters?
thinkphp’s solution to Chinese garbled output:
header("Content-Type:text/html; charset=utf-8");
This sentence defines your PHP file output encoding, but does not define the browser encoding of the HTML file, that is, the template.
This situation occurs because your development program does not define HTML encoding, and the default encoding of your browser is not uniform, so garbled characters are output.
Related recommendations: "ThinkPHP Tutorial"
Solution:
1. Modify the browser's default encoding The default encoding for the program.
2. Add an HTML Header output in front of the output of the ThinkPHP program:
echo "";
Then, the Chinese content that comes out when accessing your echo will basically not be garbled.
The above is the detailed content of What should I do if thinkphp outputs Chinese garbled characters?. For more information, please follow other related articles on the PHP Chinese website!