How to set php encoding to gbk encoding: first open the PHP page that needs to set the encoding; then add the code statement to the home page of the PHP page as "header("Content-type: text/html; charset=gb2312 ");"; Just save it at the end.
php sets the encoding by default to utf8 encoding
utf encoding:
header("Content-type: text/html; charset=utf-8");
gbk encoding:
header("Content-type: text/html; charset=gb2312");
big5 encoding:
header("Content-type: text/html; charset=big5");
Note: Usually the above code is placed on the homepage of the php page.
Recommended: "PHP Tutorial"
The above is the detailed content of How to set the encoding in php to gbk encoding. For more information, please follow other related articles on the PHP Chinese website!