//session开始 必须有下面的代码,否则无效
private function _session_start() {
$session_storage = 'session_'.pc_base::load_config('system','session_storage');
pc_base::load_sys_class($session_storage);
}
//开启session
$this->_session_start();
$_SESSION['userid']='1';
$_SESSION['username']='admin';
//获取session值
var_dump($_SESSION['userid']); //打印为1
var_dump($_SESSION['username']); //打印为admin
//注销session
unset($_SESSION['userid']);
本文转自TBHacker博客园博客,原文链接:http://www.cnblogs.com/jiqing9006/p/5807431.html,如需转载请自行联系原作者