Today, I am doing something about the PING service, because I don't want to put the ping service address into the database, that's not good. The ping service is not an inefficient task, and then put it into the database, this not only reduces the program efficiency, but also brings unnecessary losses to the server. Therefore, we try to put the ping service address in an array. in the conf file, the initial design idea is to put the generated php code. PHP file, and then put. the PHP file was loaded in. Later, it was found that the operation was not very convenient. Therefore, I decided to use the serialize () function and the unserialize () function. The usage of these two functions is really out of the box. One is to store serialized functions, the other is serialization and recovery, which is very convenient. The code for function usage is shared:
Copy codeThe Code is as follows:
<? Php
$ Array = array ();
$ Array ['key'] = 'website ';
$ Array ['value'] = 'www .chhua.com ';
$ A = serialize ($ array );
Echo $;
Unset ($ array );
$ A = unserialize ($ );
Print_r ($ );
?>
If you do not write a specific usage, you can think for yourself, and then try again. Here, I am talking about only one way of thinking and method. The specific usage should be studied by myself.