이것은 내 컨트롤러입니다. 위의 세 줄을 전역 변수로 사용해야합니다. 그래서 모든 기능이 그것을 사용할 수 있습니다. 내가 어떻게 할까?전역 변수 세션 데이터를 선언하는 방법
class Some_Controller extends CI_Controller {
$this->load->library('session'); //Must be global
$this->session->set_userdata('email', '[email protected]'); //Must be global
$data['current_user']=$this->session->userdata('email'); //Must be global
public function index(){
$data['people'] = $this->some_model->getPeople();
$data['mapList'] = $this->some_model->getMapped();
$data['appServList'] = $this->some_model->getApp_serv();
$this->load->view('templates/header.php',$data);
$this->load->view('some_page/index.php',$data);
/*Serves as the homepage. Shows the list for services, mapped services to an application and the list for application,
from here you can easily add edit and hide items*/
}
일단 세션을 설정하십시오. 어디서나 전화를 걸 수 있습니다. 전체적으로 설정할 필요가 없습니다 ...! –
하지만 작동하지 않습니다 – user3655316