php Ajax乱码



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


« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3