<?php
header('content:text/html;charset="utf8"');
$siteName='天津瓷房子';
echo $siteName.'<br>';
$title=$siteName.'位于天津市和平区\'赤峰道72号\'';
echo $title.'<br>';
$desc="{$siteName}是一幢举世无双的建筑,它的前身是历经百年的法式老洋楼,它的今生是极尽奢华的'瓷美楼奇'";
echo $desc;
echo '<hr>';
//heredoc 等价使用了双引号字符串,可以解析内部的变量和转义特殊字符
$heredoc=<<<aaa
$title
aaa;
echo $heredoc.'<br>';
//nowdoc 相当于用单引号包装的字符串
echo <<<'nowdoc'
<h3 style="color:pink;">2007年9月3日,瓷房子正式对外开放,马上成为天津市的地标建筑。</h3>
nowdoc;
?>
运行结果如下:
笔记: