在PHP中,“<<<"是什么意思?代表? [英] In PHP, what does "<<<" represent?

查看:209
本文介绍了在PHP中,“<<<"是什么意思?代表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如:

$sql = <<<MySQL_QUERY

推荐答案

这是heredoc语法.您可以通过在字符串中添加<<<以及您选择的标记来开始heredoc字符串,并通过仅在新行中放置该标记(而不能做其他任何事情!)来终止它.为方便起见,有一个例外:允许您在结束定界符后添加一个分号.

That's heredoc syntax. You start a heredoc string by putting <<< plus a token of your choice, and terminate it by putting only the token (and nothing else!) on a new line. As a convenience, there is one exception: you are allowed to add a single semicolon after the end delimiter.

示例:

echo <<<HEREDOC
This is a heredoc string.

Newlines and everything else is preserved.
HEREDOC;

这篇关于在PHP中,“&lt;&lt;&lt;&quot;是什么意思?代表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆