Blogger Information
Blog 16
fans 0
comment 1
visits 18719
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
PHP工作方式.搭建,变量定义,字符串解析2018-8-21
安丰的博客
Original
755 people have browsed it

实例

<?php
//字符串

$money ="95亿";
$title ='阿里'.$money.'收购饿了么'; //单引号 内文本链接 需要使用连接符.
echo $title;
echo "<hr>";
$title1 ="阿里{$money}收购饿了么1"; // 双引号 内文本链接 课使用{}代替原有.
echo $title1;
echo "<hr>";
$title2 ='阿里'.$money.'收购\'饿了么\'2';  //需要输出特殊标点 如单引号 需增加反斜杠进行反译
echo $title2;
echo "<hr>";
$title3 ="阿里\"{$money}\"收购\\\"饿了么\\\"3";
echo $title3;
echo "<hr>";
$title ="阿\n里{$money}收购饿了么";  //特殊参数 \N 表示一个空格
echo $title;

echo nl2br($title );                //nl2br 可按照变量中的标识空格转化为 换行 自学添加<br>

echo '<hr>';
//heredoc
echo <<<HEREDOC
{$title} \n \r;
HEREDOC;
//HEREDOC 对应用变量可自行添加双引号, 参数默认需要添加双引号,单可以被省略*/
echo '<hr>';
echo <<< 'NOWDOC'
<h3><a href="">NOWDOC使用</a></h3>
NOWDOC;
//NOWDOC  主要用于添加大量的HTML文件, 并且不允许包含参数  会被原样输出

运行实例 »

点击 "运行实例" 按钮查看在线实例

30C7E90BB07E6A4776A3672EFB42FFF7.png

Correction status:qualified

Teacher's comments:注意:heredoc和nowdoc跟前面的<<<中间不要留空格!
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post