<?PHP $information = <<<INFO Name: John Smith Address: 123 Main St City: Springville,CA INFO; echo $information; ?>
结果:
Parse error: Syntax error,unexpected T_SL on line 3
解析器抱怨,因为在倾斜的括号中声明heredoc后,您有空格.您需要确保您实际遵循heredoc语法,您可以在PHP手册网站(具体来说:
http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc)找到它.
<?PHP $information = <<<ENDHEREDOC this is my text ENDHEREDOC; echo $information;