©
이 문서에서는 PHP 중국어 웹사이트 매뉴얼 풀어 주다
(PHP 5 >= 5.1.0)
Serializable::serialize — 对象的字符串表示
返回对象的字符串表示。
Note:
这个方法担当着对象析构器的角色。在此方法之后,__destruct() 方法将不会被调用。
此函数没有参数。
返回对象的字符串表示或者 NULL
。
如果返回除了字符串或 NULL
之外的其他类型,将抛出 Exception。
[#1] crog at gustavus dot edu [2013-11-07 17:30:19]
The documentation here is somewhat misleading. Where it says "This method acts as the destructor of the object. The __destruct() method will not be called after this method," I believe the intent is not that the destructor is not run on the object itself, but that the destructor is not called /as part of the serialization process/.
That is, the object will still be destructed as it goes out of scope as normal, but the destructor is not called as a part of the object's serialization.