【发布时间】:2016-11-09 17:52:27
【问题描述】:
我正在使用 CodeIgniter REST 库。 我正在使用获取请求接受来自移动应用程序的值。在对该值执行操作后,我将相应地发送响应。 它工作正常。 但是如果参数中的值包含#号,那么#后面的参数我就无法获取到,会导致响应错误。
谁能指导我解决这个问题?
下面是代码:
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#w6737@$%&^%&user_type=abcd
我无法对请求进行任何更改。
【问题讨论】:
-
如果您发布与您的问题相关的代码部分可能会有所帮助...请查看how to ask 并考虑提供Minimal, Complete, and Verifiable example
-
我现在已经添加了代码。你能提出任何解决方案吗?
标签: php web-services rest codeigniter url