phpcms使用session
//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']);