有人能告诉我如何使用PHP字符串中的大括号{}吗?喜欢 (adsbygoogle = window.adsbygoogle || []).push({}); 最佳答案 如果遇到美元符号($),解析器将贪婪地使用尽可能多的标记来形成有效的变量名。将变量名括在大括号中以显式指定名称的结尾。<?php$beer = 'Heineken';echo "$beer's taste is great"; // works; "'" is an invalid character for variable namesecho "He drank some $beers"; // won't work; 's' is a valid character for variable names but the variable is "$beer"echo "He drank some ${beer}s"; // worksecho "He drank some {$beer}s"; // works?>Source (adsbygoogle = window.adsbygoogle || []).push({});
10-06 00:31