Php中的<<<代表什么意思?

7
在以下代码中,来自http://us2.php.net/manual/en/language.oop5.properties.php,<<<符号代表什么?
<?php
class SimpleClass
{
   // invalid property declarations:
   public $var1 = 'hello ' . 'world';
   public $var2 = <<<EOD
hello world
EOD;
   public $var3 = 1+2;
   public $var4 = self::myStaticMethod();
   public $var5 = $myVar;

   // valid property declarations:
   public $var6 = myConstant;
   public $var7 = array(true, false);

   // This is allowed only in PHP 5.3.0 and later.
   public $var8 = <<<'EOD'
hello world
EOD;
}
?>

代码有误 - EOD; 行不允许缩进。请注意,您链接的页面没有缩进该部分。 - Amber
3个回答

5

以这种方式分配字符串有什么好处? - Tegra Detra
第一个原因是您不必担心换行符。 - Bastiaan Linders

4

3

这只是定义字符串的另一种方式(Newdoc/Heredoc语法)-手册-字符串


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接