Two ways to set the encoding of PHP load page, PHP load page encoding
Two ways to set page encoding when loading pages in PHP
1: Output META tag:
1, in the PHP MVC controller or the PHP page echo ' ;
2. On a PHP page or HTML page
2: Using the header function
Inside the Controller or page header ("content-type:text/html; Charset=utf-8 ");
PHP How to set the code
mysql_connect ("localhost", "root", "");//Connect database three parameters, Web server, database account and password. \
mysql_select_db ("Lyb");//Select Database
mysql_query ("Set names gb2312")//settings transfer use the gb2312 character set to prevent garbled characters.
?>
Plus mysql_query ("Set names gb2312")//settings transfer use the gb2312 character set to prevent garbled characters.
PHP Page Coding Issues
Because your new page encoding is utf-8 even if you delete the encoding settings inside or utf-8
If you need a unified gb2312
1.DW when creating a new page Preferences select New page encoded as gb2312
2.ctrl+j re-modifying file encoding
PHP does not have coding problems except for database data because PHP does not have Chinese. As long as the page Setup problem
http://www.bkjia.com/PHPjc/852377.html www.bkjia.com true http://www.bkjia.com/PHPjc/852377.html techarticle two ways to set PHP Load page encoding method, PHP load page encoding php loading page when the page encoding two methods 1: Output META tag: 1, in the PHP MVC controller inside or ...