Programming | object | Project PHP object-oriented programming: Ways to develop large PHP projects (IV.)
Author: Luis Argerich translator: Limodou
PHP's Advanced OOP technology
after looking at basic OOP concepts, I can show you more advanced technology:
serialization (serializing)
PHP does not support persistent objects, and in OOP permanent objects are objects that can maintain state and functionality in multiple application references, meaning that the
has the ability to save objects to a file or database, and you can load objects at a later time. This is called the serialization mechanism. PHP
has a serialization method that can be invoked through an object, and the serialization method can return the string representation of an object. However, serialization only preserves the
the member data of the object without wrapping the method.
in PHP4, if you serialize an object into a string $s, then release the object, then deserialize the object to $obj, you can continue
How to use objects! I do not recommend doing this because (a) there is no guarantee in the document that this behavior can still be used in future releases. (b)
this can lead to a misunderstanding when you save a serialized version to disk and exit the script. When you run this script later, you
cannot expect the object's method to be there when an object is deserialized, because the string representation does not include the method at all.
in summary, PHP serialization is useful for saving the member variables of an object. (You can also serialize related arrays and arrays to
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.