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
<?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"); ?>
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
I hope this article will be helpful to everyone’s PHP programming design.