0
나는 codeigniter가 라이브러리를로드 할 때 세션을 설정한다는 것을 알고 있습니다. 그러나, 나는 내 자신의 규칙을 갖고 싶다. userdata를 추가하고 각 페이지로드에 userdata가 있는지 확인하여이를 수행 할 수 있다고 생각했습니다. 그러나, 그 다음은 codeigniter에서 세션로드 설정
내 환영 컨트롤러 ...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 가리키는입니다 ... 작동하지 페이지의 방문자의 체류 : 여기
는 간단한 발췌 한 것입니다 : 그것은이 '존재'에 관계없이,이 때마다 실행 ...입니다
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;
}
}
어떻게됩니까 수 변수 이자형.
누구나 알 수 있습니까? 그리고 가능한 해결책?