Blogger Information
Blog 26
fans 0
comment 0
visits 19486
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
4.11字符串输出
十一
Original
556 people have browsed it

实例

实例

<!-- <meta charset="utf-8"> -->
<?php 
header("content-type:text/html;charset=utf-8");

$fmedia = '外媒';
//$content = '$fmedia:阿尔及利亚一载约200人军机坠毁 无幸存者';
$content2 = "{$fmedia}:阿尔及利亚一载约200人军机坠毁 无幸存者";
echo $content2;
echo '<hr>';
//输出定界符使用不同类型引号
echo '习近平:"要做身体健康的民族"';
echo '<hr>';
echo "习近平:\"要做身体健康的民族\"";
echo '<hr>';
//单引号原样输出,双引号会对特殊字符进行解析
echo '单引号原样输出:明天会下雨吗? \n 不会的';
echo '<hr>';
echo "双引号对特殊字符解析:明天会下雨吗? \n 不会的";
echo '<hr>';
echo nl2br("双引号对特殊字符解析:明天会下雨吗? \n 不会的");
echo '<hr>';
// echo n12br("双引号对特殊字符解析:明天会下雨吗? \n 不会的");
//对$进行转义 \$,原样输出
$siteName = 'PHP中文网';
echo "原样输出{\$siteName}";
echo '<hr>';
$siteName = '中文网';
$heredoc = <<< abc
{$siteName}致力于打造致力于"打造"致力于打造打造!\n
致力于打造致力于打造。;
abc;
echo nl2br($heredoc);

//nowdoc对应单引号功能。
$nowdoc = <<< 'abc'
<h2>$sitename</h2> \r\n 'www.php.cn'
abc;
echo $nowdoc;

运行实例 »

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


Correction status:qualified

Teacher's comments:
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