php serialization and deserialization

 

 Serialization __sleep the time necessary to return an array, certain properties of the object returned, otherwise an error, keys key unimportant, bbbbbbbbb not important, the main value is the name of the property is not an object, which is aa not correct , a right

 

Here you can see if the sleep there is a name of a property which returns a so subsequent operation is $ de-> a = '123'; , serialization, and finally will be saved

If there is no name of a property, such as where b is not, then subsequent operations $ de-> a = '123' ; result of execution that are not saved, serialization is still the default

// $ de-> b = '123';

string(34) "O:4:"demo":1:{s:1:"a";s:4:"abcd";}" object(demo)#2 (2) { ["a"]=> string(4) "abcd" ["b"]=> string(5) "abscd" }

// $ de-> a = '123';

string(33) "O:4:"demo":1:{s:1:"a";s:3:"123";}" object(demo)#2 (2) { ["a"]=> string(3) "123" ["b"]=> string(5) "abscd" }

Guess you like

Origin www.cnblogs.com/pass-A/p/11134819.html