为什么类里没有name这个属性,$car->name = '汽车';还能运行
class Car { private $ary = array(); public function __set($key, $val) { $this->ary[$key] = $val; } public function __get($key) { if (isset($this->ary[$key])) { return $this->ary[$key]; } return null; } public function __isset($key) { if (isset($this->ary[$key])) { return true; } return false; } public function __unset($key) { unset($this->ary[$key]); } } $car = new Car(); $car->name = '汽车'; //name属性动态创建并赋值 echo $car->name;