IE9中的Codeigniter会话问题

时间:2014-12-19 03:54:58

标签: codeigniter

当我在codeigniter中使用ajax调用上传任何图像时,IE9中的会话到期,我试过这个 1.在application / libraries /中写入MY_Session.php文件,但显示此错误CI_Session未找到

      <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');  
    require_once BASEPATH . '/libraries/Session.php';  
    class MY_Session extends CI_Session{  
       function __construct()  
        {  
            parent::__construct();  
            $this->CI->session = $this;  
        }  
        function sess_update()  
        {  
            // Do NOT update an existing session on AJAX calls.  
            if (!$this->CI->input->is_ajax_request())  
                return parent::sess_update();  
        }  
    }  ?>
    /* End of file MY_Session.php */  
    /* Location: ./application/libraries/MY_Session.php */

config.php :
$config['sess_cookie_name']     = 'ci_session';
$config['sess_expiration']      = 7200;
$config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie']  = FALSE;
$config['sess_use_database']    = FALSE;
$config['sess_table_name']      = 'ci_sessions';
$config['sess_match_ip']        = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update']  = 300;

1 个答案:

答案 0 :(得分:1)

您必须首先加载CI实例,然后才能加载任何库

class MY_Session extends CI_Session{ 

     function __construct()
    {
        $this->ci =&get_instance();

        $this->ci->load->library('session');

    }

}