标签:
<?php class A{ static function loadById(){ $class_name = get_called_class(); $model = new $class_name(‘a‘); return $model; } } class B extends A{ public $name; public function __construct($str){ $this->name = $str; } } echo "beginnn<Br>"; $obj = B::loadById(); echo $obj->name; ?>
标签:
原文地址:http://www.cnblogs.com/as3lib/p/5505899.html