有人有T_PAAMAYIM_NEKUDOTAYIM吗?
当前回答
它是双冒号操作符::(参见解析器令牌列表)。
其他回答
它是PHP中::操作符的名称。它的字面意思是“双冒号”。出于某种原因,他们用希伯来语命名它。检查你的代码语法,在适当的地方放一个::
这只是发生在我的字符串赋值使用双引号。我在一个POST变量上缺少一个右花括号…
" {$_POST['txtName']在$date";
应该是
{$_POST['txtName']} on $date";
我不能解释为什么。我的意思是,我看到了会破坏代码的错误,但我不明白为什么它引用了类错误。
希伯来语是"双冒号"的意思。
对我来说,这发生在一个类函数中。
在PHP 5.3及以上版本中,$this::$默认值工作正常;当我把代码交换到一个服务器上时,不管出于什么原因,这个服务器的版本号更低,它抛出了这个错误。
解决方案,在我的情况下,是使用关键字self而不是$this:
Self::$defaults工作得很好。
从维基百科:
In PHP, the scope resolution operator is also called Paamayim Nekudotayim (Hebrew: פעמיים נקודתיים), which means “double colon” in Hebrew. The name "Paamayim Nekudotayim" was introduced in the Israeli-developed Zend Engine 0.5 used in PHP 3. Although it has been confusing to many developers who do not speak Hebrew, it is still being used in PHP 5, as in this sample error message: $ php -r :: Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM As of PHP 5.4, error messages concerning the scope resolution operator still include this name, but have clarified its meaning somewhat: $ php -r :: Parse error: syntax error, unexpected '::' (T_PAAMAYIM_NEKUDOTAYIM)
来自PHP官方文档:
The Scope Resolution Operator (also called Paamayim Nekudotayim) or in simpler terms, the double colon, is a token that allows access to static, constant, and overridden properties or methods of a class. When referencing these items from outside the class definition, use the name of the class. As of PHP 5.3.0, it's possible to reference the class using a variable. The variable's value can not be a keyword (e.g. self, parent and static). Paamayim Nekudotayim would, at first, seem like a strange choice for naming a double-colon. However, while writing the Zend Engine 0.5 (which powers PHP 3), that's what the Zend team decided to call it. It actually does mean double-colon - in Hebrew!
推荐文章
- 本地机器上的PHP服务器?
- 如何评论laravel .env文件?
- 在PHP中检测移动设备的最简单方法
- 如何在树枝模板中呈现DateTime对象
- 如何删除查询字符串,只得到URL?
- 您是否可以“编译”PHP代码并上传一个二进制文件,该文件将由字节码解释器运行?
- 非法字符串偏移警告PHP
- 从数组中获取随机项
- 为什么一个函数检查字符串是否为空总是返回true?
- 如何使用Laravel迁移将时间戳列的默认值设置为当前时间戳?
- 如何增加php的最大执行时间
- 将给定日期与今天进行比较
- PHP中接口的意义是什么?
- 致命错误:未找到类“SoapClient”
- 我目前使用的是哪个版本的CodeIgniter ?