【发布时间】:2015-04-11 20:31:56
【问题描述】:
我知道 PHP 动态变量是如何工作的,我知道我可以访问对象属性,例如
$object->{'somethingWith$var'}; 或喜欢$object->$var;
但我尝试完成的是从$object 和字符串$string = 'property->subproperty'; 访问$object->property->subproperty。
我试过$object->$string、$object->{$string}、$object->$$string哈哈哈,都没有用。
有人知道怎么做吗? :)
【问题讨论】: