This article mainly introduces the method of saving information to the current Session in PHP. It analyzes the session usage skills in PHP with examples. What is needed Friends can refer to it
The example in this article describes how PHP saves 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
?
3 4
5
6
9 10 11 |
session_start();
print("");
$_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("n");
?>
|
1 2 3 4 | A value saved in the session named as MyLogin. A value saved in the session named as MyColor. W3M red |