1.php单引号把内容当成纯文本,不会解析里面的变量,但双引号会解析里面的变量
$foo = "data";
echo '$foo'; //输出$foo
echo "$foo"; //输出data
2.单引号不解析转义字符,但'与\除外
echo 'it\'s a joke'; //输出it‘s a joke
echo 'my \n name is'; // 输出my \n name is
echo "my \n name is"; //输出my name is
网友评论