Warning: session_write_close(): Failed to write session data using user defined save handler.
网上查找了很多资料,都没有解决问题。在查询php官方文档的时候,看到评论里面的内容:当write函数返回false的时候,会发出warning警告。
public function write($id, $data) { log_message('session write start '); $uid = isset($_SESSION['userid']) ? $_SESSION['userid'] : 0; $roleid = isset($_SESSION['roleid']) ? $_SESSION['roleid'] : 0; $groupid = isset($_SESSION['groupid']) ? $_SESSION['groupid'] : 0; $m = defined('ROUTE_M') ? ROUTE_M : ''; $c = defined('ROUTE_C') ? ROUTE_C : ''; $a = defined('ROUTE_A') ? ROUTE_A : ''; if(strlen($data) > 255) $data = ''; $ip = ip(); $sessiondata = array( 'sessionid'=>$id, 'userid'=>$uid, 'ip'=>$ip, 'lastvisit'=>SYS_TIME, 'roleid'=>$roleid, 'groupid'=>$groupid, 'm'=>$m, 'c'=>$c, 'a'=>$a, 'data'=> $data, ); log_message('session data '.var_export($sessiondata,true)); $insert = $this->db->insert($sessiondata, 1, 1); log_message('insert '.$insert); if ($insert){ log_message($insert?true:false); } return true; }