This article describes how to convert a PHP array into a JSON Array. Today, we will introduce how to convert a PHP array into a JSON Array: 1. after the server transcodes the serialized characters from GBK to the UTF-8 required by soap, the returned result is: Today, we will introduce
How to convert a PHP array into a JSON Array:
1. after the server transcodes serialized characters from GBK to the UTF-8 required by soap, return the result:
- $ Str = array ("body ");
- $ Serializeserialize_str =
Serialize ($ str );
- $ Res = iconv ("GBK", "UTF-8"
, $ Serialize_str );
- Return $ res;
2. in the client side to get the results and then convert the UTF-8 to the GBK page requirements, and then print the array after deserialization is normal without Chinese garbled array:
- $iconviconv_str = iconv
("UTF-8","GBK",$res);
- $arr = unserialize
($iconv_str);
- var_dump($arr);
The above code example is the full implementation process of converting the PHP array into a JSON Array.
The specific implementation method of converting the PHP array into a JSON Array: 1. after the server transcodes the serialized character from GBK to the UTF-8 required by soap, the returned result is :...