美文网首页
PHP的变量赋值多行内容

PHP的变量赋值多行内容

作者: myloves008 | 来源:发表于2019-07-09 14:54 被阅读0次

<?php

$channel =<<<_XML_

    <channel>

    <title>What's For Dinner<title>

    <link>http://menu.example.com/<link>

    <description>Choose what to eat tonight.</description>

    </channel>

_XML_;

echo <<<END

    This uses the "here document" syntax to output

    multiple lines with variable interpolation. Note

    that the here document terminator must appear on a

    line with just a semicolon. no extra whitespace!

    <br />

END;

print $channel;

?>

结果

This uses the "here document" syntax to output

    multiple lines with variable interpolation. Note

    that the here document terminator must appear on a

    line with just a semicolon. no extra whitespace!

    <channel>

    <title>What's For Dinner<title>

    <link>http://menu.example.com/<link>

    <description>Choose what to eat tonight.</description>

注意tab也是生效了的。

相关文章

  • PHP的变量赋值多行内容

    What's For Dinner...

  • Python_学习笔记_NO.2_字符串、数据类型及循环

    多行注释及多行程序 三引号'''msg'''给变量赋值,则为多行的程序,如不赋值则为多行注释。 单双引号均可为变量...

  • js基础(印象笔记)

    代码注释单行://注释内容 多行注释:/* 内容 */ js对大小写敏感 定义变量并赋值: var ...

  • 5.PHP入门-语法概述(五)运算符

    PHP 算数运算符 PHP 赋值运算符 PHP 赋值运算符用于向变量传值。PHP 中基础的赋值运算符是 "="。这...

  • javascript赋值多行字符串的非常规方法

    js本身不支持类似PHP语言的heredoc或nowdoc语法结构,赋值一个多行文本给变量只能在换行处添加\n转义...

  • PHP学习笔记一(菜鸟教程)

    2016/10/24 1.php代码放在 2.PHP变量 ...

  • 第一节

    1.变量 1.PHP 没有创建变量的命令。变量会在首次为其赋值时被创建:变量是存储信息的容器: PHP 变量规则:...

  • 05-变量

    变量 前面我们只是简单的描述了变量的定义和赋值,这节我们详细讲解php变量 变量的值传递 php的变量和其它编程语...

  • 1. 数据类型

    基本概念 在PHP中定义变量是不支持指定类型的,而是在其赋值后根据内容自动处理。比如一个变量,给其赋值一个字符串,...

  • PHP引用变量相关问题

    什么是引用变量? 在PHP中引用意味着用不同的名字访问同一个变量内容定义方式:使用&符号 1、普通变量赋值依据co...

网友评论

      本文标题:PHP的变量赋值多行内容

      本文链接:https://www.haomeiwen.com/subject/immxkctx.html