实际上,我一直在使用 angularjs 和 restfullapis 进行忘记身份验证部分。我将密钥发送到丢失的用户邮件以获取重置密码面板。用户点击来自邮件( http://workless/services/user/reset_pwd_confirm?verification_id=72e03c6aa3268cd37067243945ac69aa&user_id=5)以下api调用的验证url。
private function reset_pwd_confirm(){
if($this->get_request_method() != "GET"){
$this->response('',406);
}
$verification_id = $this->_request['verification_id'];
$user_id = $this->_request['user_id'];
if(!empty($verification_id) && !empty($user_id) && $user_id > 0){
$tm=time()-86400;
$query = "SELECT user_id FROM user_pwd_reset WHERE user_id='".$user_id."' AND act_key='".$verification_id."' AND time > ".$tm."";
$get_user = $this->db->get_row($query);
if($this->db->num_rows == 1){
$curl = curl_init('http://localhost:3000/#/reset');
curl_setopt($ch,CURLOPT_POST, 1);
curl_setopt($ch,CURLOPT_POSTFIELDS, 'user_id='.$user_id);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_exec($curl);
}else{
$success = array('status' => "Failed", "msg" => "key and user are not match.");
$this->response($this->json($success),404);
}
}else{
$success = array('status' => "Failed", "msg" => "Invaild verification or user id.");
$this->response($this->json($success),404);
}
}
在这里,我需要使用 post user_id 移动名为http://localhost:3000/#/reset的角度页面,为此我使用了上面提到的 curl 但它返回错误为"Cannot POST /"。是什么问题?请告诉我。我认为问题是来自http get方法的请求发布,是吗?请给我解决方案...