Home > Backend Development > PHP Tutorial > PHP delimiter <<<eof uses

PHP delimiter <<<eof uses

韦小宝
Release: 2023-03-17 16:50:01
Original
1882 people have browsed it


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:


#<<……
Eof;

For example:


<?php
$js = <<<eof
<script type="text/javascript">
//top:作用使得整个frameset都跳转
window.top.location.href = "$group_url/Manager/login";
</script>
eof;
echo $js;
Copy after login

The above are the special delimiters in PHP. For more information, please go to

PHP Chinese websiteSearch

Related recommendations:

#php How to get remote image downloads and save them locally

PHP Export EXCEL Quick Development Guide

php Reference (&) Usage

The above is the detailed content of PHP delimiter <<<eof uses. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template