function message(){
$arr = array(
'1' => 'Message 1',
'2' => 'Message 2',
'3' => 'Message 3',
' 4' => 'Message 4',
'5' => 'Message 5',
'6' => 'Message 6',
'7' => 'Message 7',
'8' => 'Message 8'
);
foreach($arr as $key => $value){
$arr[$key] = urlencode ( $value );
}
$data = urldecode (json_encode ($arr));
return $data;
}
Use urlencode to traverse the array content, and finally use urlencode to process the json_encode result
The above introduces the Chinese garbled problem of json_encode in PHP, including the content of json_encode. I hope it will be helpful to friends who are interested in PHP tutorials.
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