1. Change the array to a JSON string: Json_encode ($arr [, $opti//$options is optional, default is 0
Json_encode ($arr) is generally used. However, when there is a special need, such as the data contains the absolute path of the file, like "/da1/test/123.php", the direct Json_encode will be the forward slash "/" escaped to "\",
At this point you need to add special parameters to the options, options can be selected parameters as follows:
Json_hex_tag (integer) all < and > escaped into \u003c and \u003e. Json_hex_amp (integer) All & escaped into \u0026. Json_hex_apos (integer) All ' escapes into \u0027. Json_hex_quot (integer) All "escapes into \u0022. Json_force_object (integer) causes a non-associative array to output a class (OBJECT) instead of an array. This is especially useful when the array is empty and the recipient needs a Class (Object). Json_numeric_check (integer) encodes all numeric strings into numbers (numbers), such as "1" compiled into 1json_bigint_as_string (integer) to encode large numbers as original characters. Json_pretty_print (integer) Formats the returned data with whitespace characters. Make it more beautiful Json_unescaped_slashes (integer) do not escape/, do not add this option will "/" escaped to "\" Json_unescaped_unicode (integer) to literally encode multibyte Unicode characters (encoded as \uxxxx by default).
2. Change the JSON string to an array: Json_decode ($json _str[,assoc=false]);/$json _str is the corresponding JSON string, assoc is an optional parameter, the default is False
The optional parameters are as follows:
When Assoc is false, Json_decode returns an object, not an array, that can be $obj->attr; to access the property named attr in the object $obj. When Assoc is true, Json_decode returns an array, which can be accessed by Array[key] to access the value of the corresponding key in array
The above describes the HTTPS ipcrs.pbccrc.org.cn PHP json and array conversion, including the content of the https ipcrs.pbccrc.org.cn, I hope that the PHP tutorial interested in a friend helpful.