Home >php教程 >php手册 >PHP中的<<<运算符,php中运算符

PHP中的<<<运算符,php中运算符

WBOY
WBOYOriginal
2016-06-13 08:41:312077browse

PHP中的

PHP中提供了 这种方法详细表述了字符串的字面值,并在文本中保留了字符串的下划线和其他空格(包括缩进)。例如:

  1. <span>1</span> <?<span>php
    </span><span>2</span> <span>$author</span> ='wixy'<span>;
    </span><span>3</span> <span>echo</span> <<<<span>_END
    </span><span>4</span> <span>Thisis a Headline
    </span><span>5</span> Thisis the first line.
    <span>6</span> Thisis the second line.
    <span>7</span> ---Writtenby <span>$author</span>.
    <span>8</span> <span>_END;
    </span><span>9</span> ?>
PHP解析器会将两个_END标签中间的所有内容输出,就相当于一个用双引号引用的字符串。 这意味着,我们可以将一整段HTML语言直接写在PHP代码中,然后用PHP变量来替换具体的动态部分。
  1. <span>1</span> <?<span>php
    </span><span>2</span> <span>$out</span> =<<<<span>_END
    </span><span>3</span> .....
    <span>4</span> <span>_END;
    </span><span>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