配对标记名的结尾标记名应单独一行,前后均不允许输出字符...(例如空格等不可见但存在的字符..)
我写段php代码如下:
<?
if(test case)
print<<<EOT
<....html code....>
EOF;
else
print<<<EOT
<....html code....>
EOF;
?>
如上写法是不可以的,需要把EOF标识符顶格:
<?
if(test case)
print<<<EOT
<....html code....>
EOF;
else
print<<<EOT
<....html code....>
EOF;
?>
本文介绍了一种在 PHP 中使用 HEREDOC 的正确方式,并强调了配对标记名结尾处的注意事项,避免因格式错误导致的问题。
2768

被折叠的 条评论
为什么被折叠?



