PHP中的“syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM”错误,可能是因为美元符号$的误用,看下面一种情况
class Test{
        static function test_c(){
                echo "test";
        }
}
$class="Test";
$method="test_c";
$class::$method();
 
上面类似的代码,当php版本低于5.3时就会报错,低版本php不支持变量做类的静态函数名。php5.3之后是支持的。
 
php5.3之前可以这样写:
class Test{
        static function test_c(){
                echo "test";
        }
}
$class="Test";
$method="test_c";
eval("$class::$method();");
 
用eval函数,动态执行php代码可以避免unexpected T_PAAMAYIM_NEKUDOTAYIM错误。

php出现“syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM”错误的一种情况,及解决方法的更多相关文章

  1. Parse error: syntax error, unexpected end of file in *.php on line * 解决方法

    Parse error: syntax error, unexpected end of file in *.php on line * 解决方法   这篇文章主要介绍了PHP错误Parse erro ...

  2. phpcms Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE错误

    我在phpcms的模板中自定义了一个变量,变量的值是通过pc标签赋予的. <?php $url="{$v[url]}"; ?> 结果报如上错误. 实际上应把PHP语句改 ...

  3. PHP Parse Error: syntax error, unexpected $end 错误的解决办

    可以在php.ini中设置short_open_tag = On 第一步,登录到sql命令行   第二步,使用sql语句修改root密码 使用sql语句改密码时一定要选中数据库 .使用 use mys ...

  4. 不同系统执行相同shell脚本,出现Syntax error: "(" unexpected错误解决

    例如shell脚本在centos系统中能正常执行,而在ubuntu系统中执行会出现类似Syntax error: "(" unexpected的错误,一般这种是因为sh与bash有 ...

  5. Windows登录服务器CLI运行脚本出现 syntax error: unexpected end of file 错误的解决

    0.前言 通常我们在编辑 Linux 服务器上的文件时,直接在 Linux 环境比较麻烦(当然熟练使用 VIM 的程序员除外哈哈),有时我们会使用 Windows 将文件编辑好再上传到服务器端,我用的 ...

  6. 使用帝国备份王软件提示 Parse error: syntax error, unexpected end of file

    使用帝国备份王软件提示 Parse error: syntax error, unexpected end of file时, 可以尝试一下方法: 1.php.ini要把short_open_tag ...

  7. SHELL syntax error:unexpected end of file 提示错误

    SHELL syntax error:unexpected end of file 提示错误 if [ -n "$1" ] then " else " fi e ...

  8. Ubuntu zookeeper-3.5.0-alpha启动错误 zkEnv.sh: Syntax error: "(" unexpected (expecting "fi")(转)

    昨天小猿我把Ubuntu Server64位上的 zookeeper换成了最新版本的,结果启动的时候出错:之前zookeeper-3.3.6是没有任何问题的,换成了zookeeper3.5出现了下面的 ...

  9. openwrt-scripts/config/mconf: Syntax error: “(” unexpected错误解决

    scripts/config/mconf: Syntax error: “(” unexpected错误解决 从其他地方复制而来的openwrt SDK,放在本地执行make menuconfig时出 ...

随机推荐

  1. mvc3.0 +linq 操作数据库中表的数据(ps:本人菜鸟刚学)

    1:添加控制器类文件HomeController.cs其代码如下: using System; using System.Collections.Generic; using System.Linq; ...

  2. C#实现插件式架构的方法

    插件式架构,一种全新的.开放性的.高扩展性的架构体系.插件式架构设计近年来非常流行,基于插件的设计好处很多,把扩展功能从框架中剥离出来,降低了框架的复杂度,让框架更容易实现.扩展功能与框架以一种很松的 ...

  3. struts1.3设置编码三种方法

    本文所写涉及的struts的版本是1.3x. 一.改写struts的ActionServlet. 重写process()方法: 配置相应的web.xml文件   三.通过Chain来处理: 使用cha ...

  4. C#使用简单邮件传输协议(SMTP)发送邮件

    1.首先引入命名空间: using System.Net.Mail; 2.定义邮件配置类: public class EmailServiceConfig { /// <summary> ...

  5. oracle PL/SQL(procedure language/SQL)程序设计

    PL/SQL(procedure language/SQL)语言是Oracle对SQL语言的过程化扩充,是一个完整的编程语言.PL/SQL实现了过程化语句(如分支.循环等)与SQL语句的无缝连接,将过 ...

  6. [转]c# xml.Load() locking file on disk causing errors

    本文转自:http://stackoverflow.com/questions/1812598/c-sharp-xml-load-locking-file-on-disk-causing-errors ...

  7. CF Set of Strings

    Set of Strings time limit per test 1 second memory limit per test 256 megabytes input standard input ...

  8. 关于在asp.net的web页面中的全局变量问题

    在asp.net的web页面中是不是没有全局变量?有的,在Class类内部的都是,只不过在WebWofm程式中跟WinForm和Console程式有些区别,当页面刷新时,它们的值不会保持,依然会再次初 ...

  9. Ajax中get提交和post提交的区别

    $.post("HandlerLiuYan.ashx", { leixing: leixing, danwei: danwei, liuyan: liuyan, name: nam ...

  10. IOS显示九宫格列表

    //总列数 ; CGFloat appW = ; CGFloat appH = ; //间隙 CGFloat maginX = (self.view.frame.size.width - totalC ...