How do I use single quotes inside single quotes?

前端 未结 7 1946
梦谈多话
梦谈多话 2020-12-31 14:10

Can anyone explain how to make this code work?

echo \'
Welcome
\'
相关标签:
7条回答
  • 2020-12-31 14:41

    Variable expansion doesn't work inside of single quotes. You can do either:

    echo "<div id=\"panel1-under\">Welcome {$_SESSION['username']}</div>";
    

    or

    echo '<div id="panel1-under">Welcome ' . $_SESSION['username'] . '</div>';
    
    0 讨论(0)
提交回复
热议问题