批改状态:合格
老师批语:
// __get()class user{private array $data =['age' => 18,];public function __get($name){$a = array_key_exists($name, $this->data);return $a ? $this->data[$name] : "$name 属性不存在" . '<br>';}// set()public function __set ($name,$value) {$this->$name = $value;}// __call()public function __call($name, $age){printf('%s , %s', $name, $age);}// __callstaticpublic static function __callstatic($name, $age){printf('%s, %s', $name, $age);}}class stu{protected string $name;private $age = 18;// __construct()public function __construct($name){$this -> name =$name;}}
namespace one;class a{public static function a1(){return __METHOD__;}}echo a::a1() . '<br>';echo two\a::a1() . '<br>';echo \one\two\a::a1() . '<br>';use \one\two\three\a as UserIndex;echo a::a1() . '<br>';namespace one\two;class a{public static function a1(){return __METHOD__;}}
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号