在php echo中使用特殊字符

Yla*_*ama 0 php

我使用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"

Ian*_*Ian 5

您可以使用反斜杠简单地转义字符.

$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)