<?php /* 作者 : shyhero 邮箱 : shyhero@outlook.com Q Q : 1757424878 */ class Demo{ private static $ob=null; private $name; private $age; private function __construct(){ } public static function makeOb(){ var_dump($a); if(self::$ob == null){ $c = __CLASS__; self::$ob = new $c(); } return self::$ob; } public function __set($tName,$value){ $this -> $tName = $value; } } $a = Demo::makeOb(); var_dump($a);