我有一个项目并使用codeigniter我想从codeigniter中获取数组中的id,但是idont知道热得到这里的id是结果
我从会话中获得了身份
CONTROLLER
public function index()
{
$id = $this->session->userdata('account');// this will Display the array
/******
Array
(
[ID] => 4
[account_name] => HANDSOME
[nickname] => PROGRAM
[email] => JAMPONG@ya.com
[type] => 1
)
/************************
$update=$this->load->model('profile_m');
$this->add_data('title','RESERVED')
->add_data('text', "THIS IS A DYNAMIC TEXT, or some other data");
$data['profile_id'] = $this->session->userdata('id');
$this->add_data('updated',$data['profile_id']);
$this->display_view('profile/profile_v');
}
我想获得accout ID
答案 0 :(得分:0)
$account = Array(
'ID' => 4,
'account_name' => 'HANDSOME'.
'nickname' => 'PROGRAM',
'email' => 'JAMPONG@ya.com',
'type' => 1);
$account_id = $account['ID'];
答案 1 :(得分:0)
$id = $this->session->userdata('account');
首先$id
不是像设置一样保存数组值的好名字,
所以这样的事情会很好:
$account = $this->session->userdata('account');
然后访问id:
$account['ID'];