当前位置:Gxlcms > PHP教程 > PHP使用JSON中文乱码解决实例_PHP教程

PHP使用JSON中文乱码解决实例_PHP教程

时间:2021-07-01 10:21:17 帮助过:16人阅读

json.php
$json = array (
0 => array (
id => 13,
name => 乒乓球,
),
1 => array (
id => 17,
name => 篮球,
)
);
print_r($json);
$code=json_encode($json);
echo preg_replace("#\u([0-9a-f] )#ie", "iconv(UCS-2, UTF-8, pack(H4, \1))", $code);
?>

json.html

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/486054.htmlTechArticlejson.php ?php $json = array ( 0 = array ( id = 13, name = 乒乓球, ), 1 = array ( id = 17, name = 篮球, ) ); print_r($json); $code=json_encode($json); echo preg_replace("#\u([0-...

人气教程排行