转:PHP中的“syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM”错误,在php5.2中解决

转自:http://blog.sina.com.cn/s/blog_97688f8e0101geff.html
转载:PHP中的“syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM”错误及解决方法

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();");


20130325在phpnow集成的php52环境中部署testlink1.9.6版本遇到的问题:

文章来源:http://baiweigang.cn/?p=74

posted on 2013-03-25 13:56  bwgang  阅读(282)  评论(0编辑  收藏  举报

导航