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
1161 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:
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
Latest Issues
Backslash present in Json
From 1970-01-01 08:00:00
0
0
0
Get: Transfer JSON data
From 1970-01-01 08:00:00
0
0
0
mysql storage json error
From 1970-01-01 08:00:00
0
0
0
javascript - Problems with displaying json data
From 1970-01-01 08:00:00
0
0
0
Find matching integers in JSON.
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template