1. <?php
    2. class people{
    3. private $name;
    4. private $age;
    5. function __construct($name,$age){
    6. $this->name=$name;
    7. $this->age=$age;
    8. }
    9. }
    10. $stu=new people('0ne','18');
    11. $ser=serialize($stu);
    12. echo $ser;
    13. ?>

    image.png

    反序列化的时候 直接读取本地文件 而且需要有类在。
    image.png