你那样是不行的
我这样是可以的function test() {}
$a = 'test';
$a();

解决方案 »

  1.   

    你可以通过类来实现(__call)
      

  2.   

    1.使用eval$a = 'test';
    eval("function $a(){ echo 'function name is:'.__FUNCTION__;}");
    test();
    2.使用class 的魔术方法__callclass foo{
        public function __call($name, $param){
            if($name=='test'){
                echo 'test';
            }else{
                echo 'name not exists';
            }
        }
    }$obj = new foo();
    $a = 'test';
    $obj->$a();