Home > Backend Development > PHP Tutorial > /* Process json_encode Chinese garbled characters */

/* Process json_encode Chinese garbled characters */

巴扎黑
Release: 2016-11-29 11:40:48
Original
1125 people have browsed it

<?php
/* 处理json_encode中文乱码 */
$data = array (&#39;game&#39; => &#39;冰火国度&#39;, &#39;name&#39; => &#39;刺之灵&#39;, &#39;country&#39; => &#39;冰霜国&#39;, &#39;level&#39; => 45 );
echo json_encode ( $data );
echo "<br>";
$newData = array ();
foreach ( $data as $key => $value ) {
$newData [$key] = urlencode ( $value );
}
echo urldecode ( json_encode ( $newData ) );
?>
Copy after login

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template