How to save information to the current Session in php, save the current session in php_PHP tutorial

WBOY
Release: 2016-07-13 10:03:33
Original
785 people have browsed it

How php saves information to the current Session, php saves the current session

The example in this article describes the method of php saving information to the current Session. Share it with everyone for your reference. The details are as follows:

Session variables can be saved through $_SESSION in PHP. The following code simply demonstrates the usage of $_SESSION

<&#63;php
 session_start();
 print("<html><b>");
 $_SESSION["sitename"] = "W3M";
 print("A value saved in the session named as sitename.\n");
 $_SESSION["MyChoice"] = "red";
 print("A value saved in the session named as MyChoice.\n");
 echo $_SESSION['sitename']."\n";
 echo $_SESSION['MyChoice]."\n";
 print("</b></html>\n");
&#63;>
Copy after login

The output of the above code is as follows:

A value saved in the session named as MyLogin.
A value saved in the session named as MyColor.
W3M
red
Copy after login

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/968259.htmlTechArticleHow to save information to the current Session in php, php saves the current session. This example describes how php saves information to the current Session. method. Share it with everyone for your reference. The details are as follows: p...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template