-1
我正在使用CodeIgniter REST库。 我接受使用获取请求的移动应用程序的值。在对该值执行操作后,我相应地发送响应。 它工作正常。 但是,如果参数中的值包含#符号,我无法在#之后获取参数,并导致错误的响应。Codeigniter REST:如果参数值包含#符号,则get请求不起作用
任何人都可以指导我解决这个问题吗?
下面是代码:
public function loginverification_get(){
if(isset($_REQUEST['username']))
$uname=$this->get('username');
else
$uname='';
if(isset($_REQUEST['password']))
$password=trim($this->get('password'));
else
$password='';
if(isset($_REQUEST['user_type']))
$user_type=$this->get('user_type');
else
$user_type='';
if(isset($_REQUEST['spiriva_respi']))
$appcontent=$this->get('spiriva_respi');
else
$appcontent='';
$where='';
/////////////////
SOME CODE
///////////////////
if (!empty($user))
{
$user['status'] = true;
$user['message'] = 'Successfully logged in!';
$this->set_response($user, REST_Controller::HTTP_OK);
}
else
{
$this->set_response(array(
'status' => false,
'message' => 'Login information is not valid!'
), REST_Controller::HTTP_OK);
}
}/*if($uname!='' && $user_type!='')//&& $password!='' */
else{
$this->set_response(array(
'status' => false,
'message' => 'UserName and UserType mandatory'
), REST_Controller::HTTP_OK);
}
}/// login verification
和要求是: http://domain_name/api/controllername/loginverification?username=u_name&password=y#[email protected] $%^ & &%USER_TYPE = ABCD
我不能在要求的任何变化。
如果您发布有关您的问题的代码部分这可能有助于以下方法...请参阅[如何提问](http://stackoverflow.com/help/how-to-ask)并考虑提供[最小,完整和可验证的示例](http://stackoverflow.com/help/mcve) – David
我已经添加了代码。你能建议任何解决方案吗? – user3522186