How does mysql-php display session content?

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.