解å³æ¹æ³ï¼
1ãæææçä¸æ转为UTF-8ç¼ç (æ¬èº«æ¯utf8çè¯æ 须转)
$data="JSONä¸æ";
$newData=iconv("GB2312","UTF-8//IGNORE",$data);
2ãæä¸æçurlencodeä¸ä¸
$testJSON=array('name'=>'ä¸æå符串','value'=>'test');
//echo json_encode($testJSON);
foreach ( $testJSON as $key => $value ) {
$testJSON[$key] = urlencode ( $value );
}
3ãç¶åjson_encodeä¹ååurldecodeä¸ä¸è½¬åæ¥
$test_json_str = json_encode ($testJSON )
echo urldecode ($test_json_str);
æ¥çè¾åºç»æ为ï¼
{ânameâ:âä¸æå符串â,âvalueâ:âtestâ}
è¿æ ·å¯ä»¥å¾å¥½ç解å³ä¸æJSONä¹±ç é®é¢ã
温馨提示:内容为网友见解,仅供参考