欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

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

程序员文章站 2024-04-03 17:09: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-...