PHP is a web programming language. During the programming process, you will inevitably encounter using echo to output large sections of html and javascriptIn the case of scripts, if you use the PHPtraditional output method-output by string, there must be a large number of escape characters to correct the characters in the string. Escape special characters such as quotation marks to avoid syntax errors . If it is one or two places, it can be tolerated, but if it is a complete html text or a 200-line js, I think everyone will collapse. This is why PHP introduces a delimiter - at least a large part of the reason.
1. The function of the PHP delimiter is to output the things inside it as it is, including newline format and so on;
2. Anything in the PHP delimiter Special characters do not need to be escaped; the
PHP variable in the 3.PHP delimiter will be replaced with its value normally.
The delimiter format in PHP is this:
<?php $js = <<<eof <script type="text/javascript"> //top:作用使得整个frameset都跳转 window.top.location.href = "$group_url/Manager/login"; </script> eof; echo $js;
PHP Chinese websiteSearch
Related recommendations:
#php How to get remote image downloads and save them locally
PHP Export EXCEL Quick Development Guide
The above is the detailed content of PHP delimiter <<<eof uses. For more information, please follow other related articles on the PHP Chinese website!