Home  >  Article  >  Backend Development  >  php Ajax乱码_php技巧

php Ajax乱码_php技巧

WBOY
WBOYOriginal
2016-05-17 09:37:31755browse

而AJAX支持UTF8
好了,先在PHP页上加个header(”content-type:text/html; charset=utf-8″);
告诉网页这个实现的编码是UTF-8
然后把要输出的内容用$test = iconv('gbk', ‘utf-8′, $test);转一下编码
然后在输出
大家有兴趣可以看看
 header(”content-type:text/html; charset=utf-8″); 
$test=”我是中文”; 
echo $test; 
$test = iconv('gbk', ‘utf-8′,$ test); 
echo $test;
?>

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn