2014-09-10 47 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