为什么 PHP 认为我想将该对象转换为字符串?
class Class1 {}
class Class2 {
function __construct( Class1 $class1Obj) {
$this->$class1Obj = $class1Obj; // -> Catchable fatal error: Object of class Class1 could not be converted to string
}
}
$class1Obj = new Class1();
$class2Obj = new Class2($class1Obj);