Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/rest/5.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 如何在不使用会话函数的情况下获取特定登录用户的ID,这是CodeIgniter中唯一的API方法_Php_Rest_Api_Codeigniter - Fatal编程技术网

Php 如何在不使用会话函数的情况下获取特定登录用户的ID,这是CodeIgniter中唯一的API方法

Php 如何在不使用会话函数的情况下获取特定登录用户的ID,这是CodeIgniter中唯一的API方法,php,rest,api,codeigniter,Php,Rest,Api,Codeigniter,开发者!我只想问一个问题(这是我第一次问)。使用RESTAPI方法(仅限API)获取特定登录用户的ID时,我将使用哪些方法/代码。不使用会话功能。希望你们能帮助我解决我的问题。非常感谢你 这是我的项目给我的客户。我正在为这个项目使用CodeIgniter和RESTAPI。这是我写的代码 $user_id = $this->user_model->get_user_id_from_username(!empty($this->post('id'))?$this->post(

开发者!我只想问一个问题(这是我第一次问)。使用RESTAPI方法(仅限API)获取特定登录用户的ID时,我将使用哪些方法/代码。不使用会话功能。希望你们能帮助我解决我的问题。非常感谢你

这是我的项目给我的客户。我正在为这个项目使用CodeIgniter和RESTAPI。这是我写的代码

$user_id = $this->user_model->get_user_id_from_username(!empty($this->post('id'))?$this->post('id'):$this->response(array('error'=>'id cannot be empty'), 404));
它必须显示登录到系统的用户的ID号,但始终存在错误。它总是显示出来

“错误::id不能为空”


.

这篇文章('id')中有什么内容?看起来它总是空的。如果能提供更多的上下文来解释为什么这段代码能回答这个问题,我们将不胜感激
$user_id=$this->user_model->get_user_id_from_username(empty($this->input->post('id'))?$this->input->post('id'):

$this->response(array('error'=>'id cannot be empty'), 404));