我在进入几页时收到此消息:
警告:session_start():函数 spl_autoload_call() 没有定义它在第 18 行的 /var/www/library/session/session.php 中调用的类
这是创建调用的文件:
<?php
namespace iX\session;
class session{
private static $instance;
private static $init=false;
private static function doFirstInit(){
ini_set('session.name', \iX\config::get('system')->session->name);
ini_set('session.cookie_lifetime', \iX\config::get('system')->session->cookie->lifetime);
ini_set('session.cookie_path', \iX\config::get('system')->session->cookie->path);
ini_set('session.cookie_domain', \iX\config::get('system')->domain->name);
ini_set('session.use_cookies', ((\iX\config::get('system')->session->cookie->use)?'1':0));
ini_set('session.use_only_cookies', ((\iX\config::get('system')->session->cookie->onlyCookies)?'1':0));
\iX\core::load('library/session/interface.php');
\iX\core::load('library/session/handler/'. \iX\config::get('system')->session->handler.'.php');
$class = '\iX\session\handler_'.\iX\config::get('system')->session->handler;
$class::getInstance();
session_start();
self::$init = true;
}
public static function getInstance(){
if(!self::$init)
self::doFirstInit();
if(!(self::$instance instanceof session))
self::$instance = new session('main');
return self::$instance;
}
private $handler=array();
public function __construct($handler){
$this->handler = &$_SESSION[$handler];
if(!isset($this->handler['userid']))
$this->handler['userid'] = 1;
if($this->handler['userid']==0)
$this->handler['userid'] = 1;
if(!isset($this->handler['counter']))
$this->handler['counter'] = 0;
if(!isset($this->handler['login']))
$this->handler['login'] = false;
if(!isset($this->handler['numpages']))
$this->handler['numpages'] = 0;
if(!isset($this->handler['lock']))
$this->handler['lock'] = false;
}
public function __get($name){
$this->handler['counter']++;
return (!isset($this->handler[$name]))?false:$this->handler[$name];
}
public function __set($name,$value){
if($this->lock==false){
$this->handler[$name]=$value;
return true;
}else return false;
}
public function __isset($id){
if(isset($this->handler[$id]) && $this->handler[$id]!=null) return true;
return false;
}
public function __unset($id){
$this->handler[$id] = null;
return true;
}
private function __cleanup(){
$this->handler = array();
}
public function getPages(){
return $this->numpages;
}
public function setIncreasePage(){
$this->numpages++;
}
public function Login($uid){
$this->login=true;
$this->userid = intval($uid);
$this->userId = intval($uid);
}
public function setLogout(){
foreach($this as $key=>$value)
$this->{$key} = null;
$this->role = "guest";
$this->userId = 0;
$this->login=false;
}
public function isLogin(){
return $this->login;
}
public function isRlogin(){
return ($this->rActive == true && isset($this->rLogin))?true:false;
}
public function cleanup(){
$this->__cleanup();
}
public function put(){
}
public function lock(){
$this->lock = true;
}
public function unlock(){
$this->lock = false;
}
public function get_stat(){
return $this->lock;
}
public function rewind() {
reset($this->handler);
}
public function current() {
$var = current($this->handler);
return $var;
}
public function key() {
$var = key($this->handler);
return $var;
}
public function next() {
$var = next($this->handler);
return $var;
}
public function valid() {
$var = $this->current() !== false;
return $var;
}
public function __toString(){
$return = '';
foreach($this->handler as $key=>$value)
$return .= $key.':'.$value."\n";
return $return;
}
public function __toArray(){
return $this->handler;
}
public function toString(){
return $this->__toString();
}
public function toArray(){
return $this->__toArray();
}
public function getSession(){
return $this->handler;
}
public function restoreSession($session){
$session = unserialize($session);
if(is_array($session))
$this->handler = $session;
}
}
我怎样才能摆脱这个警告。我不只是想禁用警告调用。我想要一个干净的应用程序。请有人启发我。
克里斯