Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/229.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在codeigniter中设置会话负载_Php_Codeigniter - Fatal编程技术网

Php 在codeigniter中设置会话负载

Php 在codeigniter中设置会话负载,php,codeigniter,Php,Codeigniter,我知道如果你加载库,codeigniter会为你设置会话。然而,我想有我自己的一套规则。我想我可以通过添加userdata并检查每个页面加载中是否存在userdata来实现。但是,它不起作用 这是我的欢迎控制器 class Welcome extends CI_Controller { function __construct() { parent::__construct(); //$this->output->enable_pro

我知道如果你加载库,codeigniter会为你设置会话。然而,我想有我自己的一套规则。我想我可以通过添加userdata并检查每个页面加载中是否存在userdata来实现。但是,它不起作用

这是我的欢迎控制器

class Welcome extends CI_Controller
{
    function __construct()
    {
        parent::__construct();

        //$this->output->enable_profiler(TRUE);

        $this->load->helper(array('form', 'url'));
        $this->load->library('form_validation');
        $this->load->library('session');
        $this->load->helper('url');
    }

    function index($cliqid='', $cliq=false)
    {
        $default_cliq = 5; //this equals whatever the user sets
        $this->page_m->load_session($default_cliq); //check to see if session is new; if so, perform list of actions
        //$this->session->sess_destroy();
        print_r($this->session->all_userdata());
    }
}
它指向page_m,其中包含load session方法,我希望在访客停留页面期间应用一些会话变量:

以下是一个简短的摘录:

class Page_m extends CI_Model
{
function __construct()
{
    parent::__construct();
    $this->load->model('cliq_info_m');
}

function load_session($default_cliq)
{
    //check if session is new
    if ($this->session->userdata('exists') == true) {
        //the list of things to do
        $this->record_session();   //check if ip exists in DB, if not, record     
        $this->cliq_info_m->change_active($default_cliq);

        //make session old
        $data['exissts'] = true;
        $this->session->set_userdata($data); 
    } else {
        return false;
    }
}
发生了什么…它每次都运行这个,不管“exists”变量是什么


有人知道为什么吗?还有一个可能的解决方案?

出现错误的原因似乎是我有标题错误(回显脚本警报)。一旦我移除了所有这些,它就开始工作了