简体   繁体   English

单引号或双引号的PHP Echo语法错误?

[英]PHP Echo syntax error with single quote or double quotes?

这是一个非常简单的回声,但我无法解决它?

echo '"What is your name?'";

Mismatch of single quotes, use this: 单引号不匹配,请使用:

echo '"What is your name?"';

Your first enclosing character was single quote but ending one was double quote causing the problem 你的第一个封闭字符是单引号,但结尾一个是引用问题的双引号

Incorrect: 不正确:

echo '"What is your name?'";
                          ^ Unexpected character

Correct: 正确:

echo '"What is your name?';

Correct: 正确:

echo "What is your name?";

Correct: 正确:

echo 'What is your name?';

Correct: 正确:

echo '"What is your name?"';

Correct: 正确:

echo "'What is your name?'";

您的引号嵌套不正确。

echo "\"What is your name?\"";

This is where your interpreter is choking: 这是你的口译员窒息的地方:

echo '"What is your name?' echo'“你叫什么名字?” ";

expecting ; 期待; not " 不是"

echo "What is your name?";

This is Simply the best. 这是最好的。 No confusion No problem..:) 没有困惑没问题.. :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM