Interface Summary:
1 Serializable {2 3 /* Method */4 Abstract public string serialize (void)//object string representation 5 Abstract Public mixed Unserialize (string $serialized )//Construct object 6 7}
It is very simple to use, as long as the Serialize method is called when serializing the object, and when deserializing, the Unserialize method is called.
Example:
Class Ser implements Serializable { private $_data = null; Public function __construct (array $data = null) { $this->_data = $data; } Public Function serialize () { echo ' is serializing
'; $data = $this->_data; Return serialize ($DATA); } Public Function Unserialize ($data) { echo ' is deserializing
'; $_data = Unserialize ($data); $this->_data = $_data; } Public Function Get_data () { return $this->_data; }} $d 1 = Array (' a ' = = ' A ', ' B ' = ' B '), $t 1 = new Ser ($d 1); $s 1 = serialize ($t 1);//serialization
$o 1 = unserialize ($s 1);//deserializing
Purpose: In the serialization of the image?? Using the Serialize method in the elephant,?? Daniel??。 In the deserialization of?? Using the Unserialize method in the elephant,?? Daniel??。
Can be used in model??? Seal up.