【发布时间】:2011-04-13 23:26:29
【问题描述】:
<?php
$information = <<<INFO
Name: John Smith
Address: 123 Main St
City: Springville, CA
INFO;
echo $information;
?>
结果:
解析错误:语法错误,第 3 行出现意外的 T_SL
【问题讨论】:
-
就我而言,我将整个heredoc字符串缩进了,所以我没有遵循
The closing identifier must begin in the first column of the line.的文档 -
@User 很棒的评论,这是我的问题。 PHP 为什么你这么糟糕
-
如果文件中有不同的heredoc同名但另一个有多余的空格或括号之类的东西,你也会看到这个错误