<?php$string=<<<EOD
Example of string spanning multiple lines,
such as "Tom's house",
using heredoc syntax.
EOD;//定界结束符必须定格书写echo<<<EOT
There is some string here
$string
EOT; ?>[b]运行时出现如下问题 Parse error: parse error in E:\wamp\www\Untitled-1.php on line 25
Example of string spanning multiple lines,
such as "Tom's house",
using heredoc syntax.
EOD;//定界结束符必须定格书写echo<<<EOT
There is some string here
$string
EOT; ?>[b]运行时出现如下问题 Parse error: parse error in E:\wamp\www\Untitled-1.php on line 25
Example of string spanning multiple lines,
such as "Tom's house",
using heredoc syntax.
EOD;
//定界结束符必须定格书写echo <<<EOT
There is some string here
$string
EOT;?>
1.“<<<”中间不能有空格;
2.“<<<EOD”或者“EOD;”后面不能有其他字符,包括注释或者空格。
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>使用定界符定义字符串</title>
</head><body>
<?php
$x = "hello!"; //定义一个变量
//下面输出一个定界符号字串
echo <<<str
{$x}<br />
这是用定界符定义的一个字符串.<br />
在该字符串中可以直接输出双引号("). <br />
也可以直接输出单引号(').
str;
?>
</body>
</html>
显示也错误
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>使用定界符定义字符串</title>
</head><body>
<?php
$x = "hello!"; //定义一个变量
//下面输出一个定界符号字串
echo <<<str
{$x}<br />
这是用定界符定义的一个字符串.<br />
在该字符串中可以直接输出双引号("). <br />
也可以直接输出单引号(').
str;
?>
</body>
</html>
错误20