从品牌网站建设到网络营销策划,从策略到执行的一站式服务
本篇内容主要讲解“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("