标签:
使用系统函数serialize和unserilazie
<?php class A { public $a = "aa"; public $b = 10; function __toString() { return $this->a."{$this->b}"; } } $a = new A(); echo $a; //序列化 $str = serialize($a); file_put_contents("A.txt",$str); //反序列化 $str = file_get_contents("A.txt"); $b = unserialize($str); echo $b;
标签:
原文地址:http://www.cnblogs.com/July7th/p/5663542.html