更新时间:2023-02-23 11:38:36
示例1:单引号之间的变量
如果使用单引号,则引号之间的所有内容将始终被视为字符串的一部分.
If you use single quotes everything between them will always be treated as part of the string.
$ output.='< div class ="tab-pane" id ='.$ type.'">;
示例2:双引号之间的变量(选项1)
如果您有一个要传递给字符串的变量,则可以使用双引号将其放入其中,而de variable是接触"其他单词.它应该始终有空格.
If you have a variable that you want to pass in a string you can just put it in there if you use double quotes and de variable is nog 'touching' the other words. It should always have spaces.
$output .= "<p>i would like to $your_text_here with you.</p>";
示例3:将字符串中的引号转义
可以通过在要转义的字符之前使用\(反斜杠)来转义字符串中的字符.
Escaping characters in a string can be done by using a \ (backslash) before the character you want to escape.
$output .= "<div class=\"tab-pane\" id=\"example-id\">";
示例4:双引号之间的变量,且其旁边没有空格
如果使用双引号(选项2),则可以将变量放在{}大括号之间
You can place your variable between {} braces if you use double quotes (option 2)
$output .= "<div class=\"tab-pane\" id=\"{$type}\">";