Two methods are used to set the encoding when php loads the page. php loads the page encoding. Two methods are used to set the encoding when php loads the page. php loads the page encoding. php loads the page encoding. one is the output meta tag: 1. in the phpmvc controller, or in two ways to set the php encoding when loading the page, php loads the page encoding
Two methods for setting page encoding when php loads a page
1: output meta tag:
1. echo' ';
2. on the php page or html page
2: Use the header function
In the controller or page header ("content-type: text/html; charset = utf-8 ");
How to set encoding in php
Mysql_connect ("localhost", "root", ""); // Three database connection parameters: web server, database account, and password. \
Mysql_select_db ("lyb"); // select a database
Mysql_query ("set names gb2312") // sets transmission to use the gb2312 character set to prevent garbled characters.
?>
Add mysql_query ("set names gb2312") // you can use the gb2312 character set to prevent garbled characters during transmission.
PHP page encoding
Because the page code you created is UTF-8, even if you deleteThe encoding settings are UTF-8.
If you need a uniform gb2312
1. when creating the dw page, select the new page encoding as gb2312 as the preferred parameter.
2. ctrl + j re-modify the file encoding
Php does not have the encoding problem except the database data because php does not have Chinese characters .. As long as the page settings are incorrect
Two methods for setting page encoding when loading a page in php: output meta tag: 1. in the controller of php mvc or...