所以我想这样做:
$ob = new $this->other_class_name;
但是失败了。我怎么能做到这一点,而不存储other_class_name在本地变量?
将名称保存在另一个变量中:
$class = $this->other_class_name;
$ob = new $class;
试试这个:
$class = get_class($this->other_class_name);
$ob = new $class;