在此示例中,如何从 object$containerObj
中的getContainerID()
方法访问 object 中的属性$containerObj->bar
,或者至少获取指向的指针$containerObj
?
class Foo {
public $id = 123;
}
class Bar {
function getContainerID() {
... //**From here how can I can access the property in the container class Foo?**
}
}
$containerObj = new Foo();
$containerObj->bar = new Bar();
echo $containerObj->bar->getContainerID();