Home  >  Article  >  php教程  >  php保存信息到当前Session的方法

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

WBOY
WBOYOriginal
2016-06-06 20:06:42879browse

这篇文章主要介绍了php保存信息到当前Session的方法,实例分析了php中session的使用技巧,需要的朋友可以参考下

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

php中可通过$_SESSION保存session变量,下面的代码简单演示了 $_SESSION的用法

"); $_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("

Statement:
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