PHP的标记符<<
测试程序echo "你好\n";
$variable = '啊哈哈';
echo <<
This uses the "here document" syntax to output
multiple lines with $variable interpolation. Note
that the here document terminator must appear on a
line with just a semicolon. no extra whitespace!
END;
?>
会得到Parse error: syntax error, unexpected end of file in的错误
原来是因为标记符号必须顶头写,好像所有语言的标记符都是这样的,比如汇编。所以正确的用法是:
测试程序echo "你好\n";
$variable = '啊哈哈';
echo <<
This uses the "here document" syntax to output
multiple lines with $variable interpolation. Note
that the here document terminator must appear on a
line with just a semicolon. no extra whitespace!
END;
?>