2014-09-10 45 views
0

我在脚本中的PHP脚本中找到了这个构造:echo <<<Start;PHP - 不可知的回声<<<构造

这是什么意思?

我的假设是这是一种重定向,但它只是一个假设,我想知道这个构造的真正功能。

+3

http://php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc它具有一种方式多行字符串,称为heredoc语法 – Steve 2014-09-10 09:55:59

回答

1

它被称为heredoc语法:

echo <<<END 
This uses the "here document" syntax to output 
multiple lines with $variable interpolation. Note 
that the here document terminator must appear on a 
line with just a semicolon. no extra whitespace! 
END; 
+0

示例来自http://php.net/manual/en/function.echo.php – max 2014-09-10 09:59:28