<< Available in PHP <运算符构建多行字符串序列的方法,通常称为here-document或表示为heredoc的简写。< p>
This method details the literal value of the string and preserves the underscore and other spaces (including indentation) of the string in the text. For example:
1
PHP2$author = ' Wixy '; 3 echo <<<_end4thisis a headline5 thisis the first line. 6 Thisis the second line. 7 $author. 8 _end; 9 ?>
The PHP parser outputs all the content in the middle of the two _end tags, which is equivalent to a string quoted in double quotes.
This means that we can write an entire HTML language directly into the PHP code, and then replace the specific dynamic parts with PHP variables.
1
PHP2$out =<<<_end3 ..... 4 _end; 5 ?>
You can also assign the contents of two tags to a variable in this way.
Note : The _end tag that is used to close must be placed on a single line, and no other content can be added to this line, even if comments or spaces are not allowed
The above describes the << in PHP<>