In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
Today, the editor will share with you the relevant knowledge about whether php can be serialized. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.
Php can be serialized. In php, you can use the serialize () function to serialize, convert the value into a string that can be stored, and the syntax "serialize (variable to serialize)"; you can also use the unserialize () function to deserialize, changing the string back to the original value of PHP.
Operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
Serialization is the process of converting a variable in memory into a string that can be saved or transferred. Deserialization is to convert the string into the original variable at the appropriate time. The combination of these two processes can easily complete the data storage and transmission operation, making the program more maintainable.
Php can also implement serialization.
In php, you can use the serialize () function to serialize and convert the value into a string that can be stored; you can also use the unserialize () function to change the string back to the original value of PHP, that is, deserialization.
The syntax format of the serialize () function is as follows:
Serialize (mixed $value)
Where $value is the variable to be serialized.
The serialize () function can handle any type except resource (resource). When an object is serialized, PHP calls the object's _ _ sleep () member function before the sequence action. This allows the object to do any cleanup before it is serialized. Similarly, when you deserialize an object with unserialize (), the _ _ wakeup () member function is called.
[example] serialize an object using the serialize () function.
Extended knowledge: deserialization
When you serialize an object using the serialize () function, you can save the resulting string to a file or database, and then use the unserialize () function to deserialize the string where needed. The syntax format of the unserialize () function is as follows:
Unserialize (string $str)
Where $str is the serialized string using the serialize () function. If the string passed in cannot be deserialized, FALSE is returned and an E_NOTICE is generated.
[example] deserialize the string obtained above.
These are all the contents of the article "can php be serialized?" Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.