The so-called File Cache data is to put some non-frequently changed data in the file for use, instead of getting data through database Io.
1. var_export ($ array, [True])
#. Uchome and discuz systems use a relatively large number of methods, usually to store some system configs data such as credit rules, mail configuration information, etc., by the method cache_write () store the data read from the database to a file.
Eg:
Var_export ($ ARR); // directly outputs a string
$ A = var_export ($ arr, true); // assign this string to a variable
Echo $ A; // same as var_export ($ ARR );
Benefit: var_export () saves an array as an array like "array ('A' => array (....), the string 'B' => XXX) "completely retains the array format, so you only need to splice the string: '$ arr_name = '. var_export ($ ARR); in this way, it is easy to call the data. You only need to input the file require to use this array $ arr_name.
2. serialize ()/unserialize ()
Eg:
$ Se = serialize ($ ARR); // return string
$ Unse = unserialize ($ SE); // return Array
3. json_encode/json_decode
#. Here we need to figure out the relationship between the JSON object and the associated array.
Eg:
$ Json_en = json_encode ($ ARR); // return string
$ Json_de1 = json_decode ($ json_en); // return JSON object
Echo $ json_de1-> attr1; // outputs attributes as a JSON object
$ Json_de2 = json_decode ($ json_en, true); // force return Array
Echo $ json_de2 ['attr1']; // output as an associated array
[Test] serialize/unserialize is the fastest among the three types.