1. 云栖社区>
  2. PHP教程>
  3. 正文

php保存信息到当前Session

作者:用户 来源:互联网 时间:2017-12-01 11:16:04

php保存session信息当前

php保存信息到当前Session - 摘要: 本文讲的是php保存信息到当前Session,<?php session_start(); print(""); $_SESSION["sitename"] = "W3M"; print("A value saved in the session named as sit

<?php
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");
?> 上面的代码输出结果如下:A value saved in the session named as MyLogin.
A value saved in the session named as MyColor.
W3M
red

以上是云栖社区小编为您精心准备的的内容,在云栖社区的博客、问答、公众号、人物、课程等栏目也有的相关内容,欢迎继续使用右上角搜索按钮进行搜索php , 保存 , session , 信息 当前 ,以便于您获取更多的相关知识。