search
Homephp教程php手册PHP中的<<<运算符 - wixy

PHP中提供了

这种方法详细表述了字符串的字面值,并在文本中保留了字符串的下划线和其他空格(包括缩进)。例如:
  1. <span style="color: #008080;">1</span> <span style="color: #000000;">php
    </span><span style="color: #008080;">2</span> <span style="color: #800080;">$author</span> ='wixy'<span style="color: #000000;">;
    </span><span style="color: #008080;">3</span> <span style="color: #0000ff;">echo</span> _END
    <span style="color: #008080;">4</span> <span style="color: #000000;">Thisis a Headline
    </span><span style="color: #008080;">5</span> Thisis the first line.
    <span style="color: #008080;">6</span> Thisis the second line.
    <span style="color: #008080;">7</span> ---Writtenby <span style="color: #800080;">$author</span>.
    <span style="color: #008080;">8</span> <span style="color: #000000;">_END;
    </span><span style="color: #008080;">9</span> ?>
PHP解析器会将两个_END标签中间的所有内容输出,就相当于一个用双引号引用的字符串。
这意味着,我们可以将一整段HTML语言直接写在PHP代码中,然后用PHP变量来替换具体的动态部分。
  1. <span style="color: #008080;">1</span> <span style="color: #000000;">php
    </span><span style="color: #008080;">2</span> <span style="color: #800080;">$out</span> =_END
    <span style="color: #008080;">3</span> .....
    <span style="color: #008080;">4</span> <span style="color: #000000;">_END;
    </span><span style="color: #008080;">5</span> ?>
也可用上面这种方式将两个标签中的内容赋值给变量。
 
注意:用来关闭的_END标签必须单独放在一行,而且这一行中不能添加其他内容,即使注释或者空格也不允许
Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Repo: How To Revive Teammates
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment