您好,欢迎访问一九零五行业门户网

php 魔术方法 __sleep __wakeup __toString __debuginfo

__sleep():
使用serialize()序列化的时候,会检测类中是否有__sleep()魔术方法,有的话会先调用__sleep(),返回一个包含对象中所有需要序列化的变量名称的数组
__wakeup()
使用serialize()序列化的时候,会检测类中是否有__wakeup()魔术方法,有的话会先调用__wakeup(),执行一些初始化操作
say(); } }$test = new test();unserialize(serialize($test));//输出结果:反序列化
__tostring()
__tostring()用于一个类被当做字符串使用时的回应,只能返回一个字符串
__debuginfo()
__debuginfo() 是php5.6增加的特性,var_dump()一个类时的回应,返回一个包含对象属性的数组
string(4) name }
').addclass('pre-numbering').hide(); $(this).addclass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadein(1700); }); }); 以上就介绍了php 魔术方法 __sleep __wakeup __tostring __debuginfo,包括了方面的内容,希望对php教程有兴趣的朋友有所帮助。
其它类似信息

推荐信息