21,887
社区成员
发帖
与我相关
我的任务
分享
<?php
@header("Content-type:text/html;charset=GB2312");
$arr = array ('name'=>"贾朝藤",'age'=>19,'sex'=>"男",'add'=>"中国石家庄");
echo json_encode($arr);
echo "<br/>";
$name = iconv("GBK","UTF-8","贾朝藤");
$sex = iconv("GBK","UTF-8","男");
$add = iconv("GBK","UTF-8","中国石家庄");
$arr = array ('name'=>"$name",'age'=>19,'sex'=>"$sex",'add'=>"$add");
echo $str=json_encode($arr);
?>
{"name":"\u8d3e\u671d\u85e4","age":19,"sex":"\u7537","add":"\u4e2d\u56fd\u77f3\u5bb6\u5e84"}
Notice: iconv() [function.iconv]: Detected an illegal character in input string in D:\wamp\www\ajax\js_php.php on line 6
Notice: iconv() [function.iconv]: Detected an illegal character in input string in D:\wamp\www\ajax\js_php.php on line 7
Notice: iconv() [function.iconv]: Detected an illegal character in input string in D:\wamp\www\ajax\js_php.php on line 8
{"name":"\u7490\u70ac","age":19,"sex":"","add":"\u6d93"}
{"name":"\u8d3e\u671d\u85e4","age":19,"sex":"\u7537","add":"\u4e2d\u56fd\u77f3\u5bb6\u5e84"}
Notice: iconv() [function.iconv]: Detected an incomplete multibyte character in input string in D:\wamp\www\ajax\js_php.php on line 6
Notice: iconv() [function.iconv]: Detected an incomplete multibyte character in input string in D:\wamp\www\ajax\js_php.php on line 7
Notice: iconv() [function.iconv]: Detected an illegal character in input string in D:\wamp\www\ajax\js_php.php on line 8
{"name":"\u7490\u70ac\u6e5e\u9498","age":19,"sex":"\u9422","add":"\u6d93"}
{"name":"\u8d3e\u671d\u85e4","age":19,"sex":"\u7537","add":"\u4e2d\u56fd\u77f3\u5bb6\u5e84"}
Notice: iconv() [function.iconv]: Detected an incomplete multibyte character in input string in D:\wamp\www\ajax\js_php.php on line 6
Notice: iconv() [function.iconv]: Detected an incomplete multibyte character in input string in D:\wamp\www\ajax\js_php.php on line 7
{"name":"\u7490\u70ac\u6e5e\u9498","age":19,"sex":"\u9422","add":"\u6d93\u9365\u754c\u7176\u7039\u8dfa\u7c1e"}