The php file should be saved as ANSI, and you can use code adjustment when changing the encoding.
Copy code The code is as follows:
//The encoding is gb2312. At present, most web pages still use gb2312, and a few use utf -8,
//www.baidu.com actually uses both, so there is no problem in reading baidu webpages
header('Content-Type: text/html; charset=gb2312');
//Encoded to utf-8
header('Content-Type: text/html; charset=gb2312');
//Encoded xml to utf-8, but it seems to work
header ('Content-Type: text/xml; charset=utf-8');
jquery client processing
The client webpage is saved as utf-8, and the following settings are made , and the database is also set to utf-8, so that data transmitted using ajax is not easily garbled.
Copy code The code is as follows:
Copy code The code is as follows:
//It is recommended to use $.get(), $.post(), try not to use $.ajax(), there will be fewer problems and more convenience.
//:) But it’s a different matter if you study the jquery source code!
$.get("test.php", function(data){
alert("Data Loaded: " + data) ;
});
$.get("test.cgi", { name: "John", time: "2pm" },
function(data){
alert("Data Loaded : " + data);
});
$.post("test.cgi", { name: "John", time: "2pm" },
function(data){
alert("Data Loaded: " + data);
});
Personal experience and imperfections, please tell me more and I will listen carefully to your corrections. Aiming to encourage each other!
http://www.bkjia.com/PHPjc/322565.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/322565.htmlTechArticlephp files should be saved as ANSI, and you can use code adjustment when you want to change the encoding. Copy the code The code is as follows: //The encoding is gb2312. Currently, most web pages still use gb2312, and a few use utf-8. //www.baidu.com actually has two...