class Index extends Api
{
public $test ="1111";
public function index()
{
$aaa=[
"aa"=>'test'
];
$bb = $aaa["aa"];
print($this->$bb);//结果能获取到 111 ,太神奇了
}
}
class Index extends Api
{
public $test ="1111";
public function index()
{
$aaa=[
"aa"=>'test'
];
$bb = $aaa["aa"];
print($this->$bb);//结果能获取到 111 ,太神奇了
}
}
本文标题:神奇的php 通过字符串获取对象的属性
本文链接:https://www.haomeiwen.com/subject/tatugctx.html
网友评论