“<<<"的名字是什么?操作员?
我知道这很简单,但也无法搜索...
I know this is going to be straight forward but its also impossible to search for...
这三个箭头的正确术语/名称是什么 - 例如
what is the correct term / name for this 3 arrow thing - e.g.
<<< HTML
谢谢!
推荐答案
Heredoc:
分隔strings的第三种方法是heredoc语法:<<<.在这个运算符之后,提供了一个标识符,然后是一个换行符.string 本身跟随,然后再次相同的标识符关闭引用.
A third way to delimit strings is the heredoc syntax: <<<. After this operator, an identifier is provided, then a newline. The string itself follows, and then the same identifier again to close the quotation.
结束标识符必须从行的第一列开始.此外,标识符必须遵循与 PHP 中任何其他标签相同的命名规则:它必须仅包含字母数字字符和下划线,并且必须以非数字字符或下划线开头.
The closing identifier must begin in the first column of the line. Also, the identifier must follow the same naming rules as any other label in PHP: it must contain only alphanumeric characters and underscores, and must start with a non-digit character or underscore.
警告 请务必注意,带有结束标识符的行不得包含任何其他字符,分号 (;) 除外.这尤其意味着标识符不能缩进,分号前后不能有任何空格或制表符.认识到结束标识符之前的第一个字符必须是本地操作系统定义的换行符也很重要.这是 UNIX 系统上的 ,包括 Mac OS X.结束定界符后面还必须跟一个换行符.
Warning It is very important to note that the line with the closing identifier must contain no other characters, except a semicolon (;). That means especially that the identifier may not be indented, and there may not be any spaces or tabs before or after the semicolon. It's also important to realize that the first character before the closing identifier must be a newline as defined by the local operating system. This is on UNIX systems, including Mac OS X. The closing delimiter must also be followed by a newline.
如果违反了这条规则并且结束标识符不是干净的",它不会被认为是结束标识符,PHP 将继续寻找一个.如果在当前文件结束前没有找到合适的结束标识符,最后一行将导致解析错误.
If this rule is broken and the closing identifier is not "clean", it will not be considered a closing identifier, and PHP will continue looking for one. If a proper closing identifier is not found before the end of the current file, a parse error will result at the last line.
Heredocs 不能用于初始化类属性.自 PHP 5.3 起,此限制仅对包含变量的 heredocs 有效...
Heredocs can not be used for initializing class properties. Since PHP 5.3, this limitation is valid only for heredocs containing variables...
相关文章