Two methods to set the page encoding when PHP loads the page
1: Output meta tag:
1. In the php mvc controller or php page echo '';
2. In the php page or html page
2: Use header function
In the controller or page header("content-type:text/html; charset=utf-8");
mysql_connect("localhost","root","");//Connect to the database with three parameters: web server, database account and password. \
mysql_select_db("lyb");//Select the database
mysql_query("set names gb2312") //Set the transmission to use the gb2312 character set to prevent garbled characters.
?>
Add mysql_query("set names gb2312") //Set the transmission to use the gb2312 character set to prevent garbled characters.
Because the encoding of your new page is utf-8, even if you delete the encoding setting in
it is still utf-8