我使用if函数来显示副本,但这个副本必须用双引号括起来,我不能让它工作.请帮忙.
码
$currentpage = $_SERVER['REQUEST_URI'];
if ($currentpage == "/room/penthouse-suite/"){
echo "<div class='text-center text-emphasis text-lg'>"test penthouse"</div>";
}
Run Code Online (Sandbox Code Playgroud)
所以在我的页面上它应该显示---> "test penthouse"
您可以使用反斜杠简单地转义字符.
$currentpage = $_SERVER['REQUEST_URI'];
if ($currentpage == "/room/penthouse-suite/"){
echo "<div class='text-center text-emphasis text-lg'>\"test penthouse\"</div>";
}
Run Code Online (Sandbox Code Playgroud)