Blogger Information
Blog 15
fans 0
comment 0
visits 8755
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
创建虚拟主机的过程,变量的命名规则,web服务器访问原理
if柚的博客
Original
922 people have browsed it

5A60547D65456C1F2CDA13F3960EF4C4.png7E061C796904CF542A3AFCD1B4A65D8F.png

实例

<meta charset="utf-8">
<?php
$myName='swisun';
echo $myName;
echo '<hr>';
echo '$myName'; // 单引号不会转义,是什么就输出什么
echo '<hr>';
echo "$myName"; //双引号会转义,会解析双引号里面的内容,现在双引号里面是一个变量,变量里面的值是swisun,所以输出swisun
echo '<hr>';
echo "swisun"; //这个没什么意义,直接输出原样就行
echo '<br>';
 echo '我3个月后将会从"布衣"升级成"php大牛"';
echo '<br>';
 echo "我3个月后将会从'布衣'升级成'php大牛'";
echo '<br>';
 echo  '我3个月后将会从\'布衣\'升级成\'php大牛\'';
echo '<br>';
/*这个地方简单点理解就是在heredoc上面套了一个大双引号,heredoc只是一个代号而已,这个代号必须大写
*/
echo <<< 'HEREDOC'

$myName
HEREDOC;
echo '<br>';
echo <<<  "NOWDOC"
$myName
NOWDOC;
?>

运行实例 »

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


Correction status:qualified

Teacher's comments:注意:heredoc和nowdoc跟前面的<<<中间不要留空格!而且heredoc要被双引号包裹,而nowdoc是要被单引号包裹的,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