插入字符串的第三种方法是使用heredoc方法,在这种方法,字符串以<<<和一个标识符开头继续,知道php结尾由左对齐的相同标识符和分号:
-----------------------------------------------------------------------------------------------------------------------
echo <<<END
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;
--------------------------------------------------------------------------------------------------------------------------
最后一个END;必须是左对齐的!!!!!
本文详细介绍了在PHP中使用heredoc方法插入字符串的技巧,包括语法、使用示例及注意事项。
1893

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



