Home >Backend Development >PHP Tutorial >PHP uses JSON Chinese garbled solution example_PHP tutorial

PHP uses JSON Chinese garbled solution example_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-13 17:42:27955browse

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
<script><br>$.getJSON("json.php",<br>        function(data) {<br>                for (var i = 0; i < data.length; i ) {<br>                alert(data[i].name);<br>        }<br>});<br></script>

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-...
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