Heim  >  Artikel  >  Backend-Entwicklung  >  php保存信息到当前Session的方法,php保存当前session_PHP教程

php保存信息到当前Session的方法,php保存当前session_PHP教程

WBOY
WBOYOriginal
2016-07-13 10:03:33757Durchsuche

php保存信息到当前Session的方法,php保存当前session

本文实例讲述了php保存信息到当前Session的方法。分享给大家供大家参考。具体如下:

php中可通过$_SESSION保存session变量,下面的代码简单演示了 $_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;>

上面的代码输出结果如下:

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

希望本文所述对大家的php程序设计有所帮助。

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/968259.htmlTechArticlephp保存信息到当前Session的方法,php保存当前session 本文实例讲述了php保存信息到当前Session的方法。分享给大家供大家参考。具体如下: p...
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn