In the session, $ _ SESSION [& #039; nickName & #039;] is saved. In the subsequent menu bar, I want to display the user's nickName {code ...} how can I add HTML code to make it look like & amp; lt; div & amp; gt; $ _ SESSION [& quot; nickName & quot;] & amp; lt; the format of div & amp; gt; is saved in the session.
$_SESSION['nickName']
In the subsequent menu bar, I want to display the nickname of the user
if(isset($_SESSION["userId"])){ echo $_SESSION["nickName"];}
How can I add HTML code to make it look similar
$ _ SESSION ["nickName"]
To display
Reply content:
Saved in session$_SESSION['nickName']
In the subsequent menu bar, I want to display the nickname of the user
if(isset($_SESSION["userId"])){ echo $_SESSION["nickName"];}
How can I add HTML code to make it look similar
$ _ SESSION ["nickName"]
To display
The answer is braces {}.
I don't understand. I can't solve this problem. I found it, so I Share it. I'm not good at speaking because someone makes a mistake and says nothing. Can you look down on beginners, what's more, it seems that you are normal? It doesn't matter if you call a group of people to give negative comments or anything. What do you like will not affect me. I come to learn, not to quarrel. Do you want to give it to others?
Learn the basics and then write code.
if(isset($_SESSION["userId"])) { echo $_SESSION["nickName"];}
Directly:
if(isset($_SESSION["userId"])){ echo {$_SESSION["nickName"]; }
Why should I add single quotes?
if(isset($_SESSION["userId"])) { echo $_SESSION["nickName"];}
If you add '', it means that the output is a string. After you remove'', It is the SESSION variable.
Nowadays, people are getting better and better at asking questions.