20,359
社区成员
发帖
与我相关
我的任务
分享
$a = 'test';
eval("function $a(){ echo 'function name is:'.__FUNCTION__;}");
test();
2.使用class 的魔术方法__call
class foo{
public function __call($name, $param){
if($name=='test'){
echo 'test';
}else{
echo 'name not exists';
}
}
}
$obj = new foo();
$a = 'test';
$obj->$a();
function test() {}
$a = 'test';
$a();