且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在PHP中,“<<<"是什么意思?代表?

更新时间:2022-12-07 21:51:19

这是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;