我正在尝试使用rest api从一个函数到另一个函数的变量。这是我的代码。
$this->session->set_userdata('some_name', $authUser['id']);
$this->session->userdata('some_name');
public function clinic_post() {
$area = $this->post('area');
$locality = $this->post('locality');
$add_image = array(
'area'=>$area,
'locality'=>$locality,
'doctor_id' => $this->session->userdata('some_name')
);
$this->load->model('ApiModel');
$this->ApiModel->clinic_insert($add_image);
}
您需要使用$this->session->userdata("some_name"(;来获取已设置的会话。$this->session->set_userdata("some_name","value"(;将值设置为会话