宝塔服务器面板,一键全能部署及管理,送你10850元礼包,点我领取

PHP中的“syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM”错误
class Test{
        static function test_c){
                echo "test";
        }
}
$class="Test";
$method="test_c";
$class::$method);

上面类似的代码在php5.3之前会报错,就是php版本不支持$变量做类名函数名。php5.3之后是支持的。

php5.3之前可以这样写:
class Test{
        static function test_c){
                echo "test";
        }
}
$class="Test";
$method="test_c";
eval"$class::$method);");

本文转自:http://blog.sina.com.cn/s/blog_97688f8e0101geff.html