class E { public $age = 0; public $username = ""; public $obj = null; public function __clone() { // TODO: Implement __clone() method. $this->obj = clone $this->obj; } } class F { public $sex = 0; } $e = new E(); $e->obj = new F(); $f = clone $e; $f->obj->sex = 8; var_dump($f->obj->sex);//int(8),为什么还是8,应该为0啊
var_dump($e->obj->sex);为0,谢谢采纳