Finally, I discovered the problem. It turns out that this type of document must be close to the first position of the line at the end, which means that there cannot be a space before EOF. For the sake of code indentation, this problem happened.
heredoc uses the <<< EOT identifier, while nowdoc uses the <<< 'EOT' identifier. Nowdoc is a new technology introduced in PHP5.3, which contains the syntax of heredoc. , but the content will never be escaped or interpreted in any way. The content is what it is, and PHP-related content will not be parsed
It is recommended to use {$name->change()} for PHP variables in heredoc Enclosed in curly brackets, this can avoid certain ambiguities. If you want to output it as it is, you can use the legendary escape character. The escape character itself can be output using the escape character, that is, this representation method. Braces and the like are all Output needs to be escaped.
In order to ensure that it is usable, it is recommended to use heredoc syntax, which also has escapes. Because the nowdoc syntax was introduced in PHP5.3, many cloud hosting environments may not support it, causing problems.
Finally, heredoc was introduced from PHP 4.0, while nowdoc syntax requires version 5.3. Because heredoc includes the functions of nowdoc, I personally suggest that it is better to use heredoc.
Simply put:
1. Heredoc is dynamic and nowdoc is static
2. Heredoc is similar to multi-line double quotes; newdoc is similar to multi-line single quotes
3. Heredoc is a specialized processing A general processing solution for large strings, and nowdoc is a "highly efficient" static version implemented by PHP to make up for the efficiency problem of dynamic implementation of "heredoc"