Blogger Information
Blog 12
fans 0
comment 0
visits 10466
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
变量命名+服务器访问原理+字符串变量解析8月21号
刘永鹏的博客
Original
628 people have browsed it

变量命名、服务器访问原理

QQ图片20180826101627.jpg

字符串变量解析

实例

<?php 

$money = '7299元';
$a = "这\"电脑\"要$money";
$b = '这\'电脑\'要$money';
$c = "这\'电脑\'要$money";

// 双引号里面的单引号不需要转义
// 如果是单引号里面包含单引号才需要转义,单引号通常用引用HTML语句
// 双引号里面包含双引号需要转义
// HEREDOC相当于双引号
// NOWDOC相当于单引号

echo $a,'<br>';
echo $b,'<br>';
echo $c,'<br>';
echo  <<< "HEREDOC"
{$a} <br>
HEREDOC;

echo <<<"NOWDOC"
{$b} ,<n>  <r> <t>
<h3><a href="">Hello 同学们晚上好呀</a></h3>
NOWDOC;



 ?>

运行实例 »

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

QQ截图20180826101840.png

总结

 双引号里面的单引号不需要转义
 如果是单引号里面包含单引号才需要转义,单引号通常用引用HTML语句
双引号里面包含双引号需要转义
 HEREDOC相当于双引号
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