Correction status:qualified
Teacher's comments:
<!doctype html> <html lang="zh-Hans"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> </head> <body> <h3>php字符串变量解析-单引号</h3> <?php $danName='单引号'; echo ' "\\这是\''.$danName.'\'的变量解析" '; ?> <h3>php字符串变量解析-双引号</h3> <?php $danName="双引号"; echo "\"\\这是'{$danName}'的变量解析\"" ?> <h3>herdoc语法</h3> <?php $danName="herdoc"; echo <<<HEREDOC {$danName} \t \r \n 等价于使用了双引号的字符串,可以解析内部的变量和转义特殊字符 <b>$danName</b> HEREDOC; ?> <h3>nowdoc语法</h3> <?php $danName="herdoc"; echo <<<'NOWDOC' {$danName} .$danName. '$danName' \t \r \n <br> <b>nowdoc语法</b>相当于用单引号包装的字符串,可以用来包装html代码<br> <b>不能解析内部的变量和转义特殊字符</b> NOWDOC; ?> </body> </html>
点击 "运行实例" 按钮查看在线实例