瘦客户端请求在远程服务器上返回404错误
问题描述:
我正在为我的iOS应用程序使用API。 API通过webservice与数据库交互。 API是在Slim框架的帮助下编写的。我在本地服务器上测试了API,并且一切正常。在上传他们到活服务器我注意到所有的请求与GET方法仍然工作,但要求与POST无法在远程服务器上工作,并总是返回404页面未找到错误。我刚刚测试了一个API,从POST转换为GET,它按预期工作。以下是我的Slim post请求代码。瘦客户端请求在远程服务器上返回404错误
\Slim\Slim::registerAutoloader();
$app = new \Slim\Slim();
$app->post('/forgotPassword', function() use ($app){
verifyRequiredParams(array('email'));
$response = array();
// reading post params
$email = $app->request->post('email');
$db = new DbHandler();
$res = $db->forgotPassword($email);
if ($R = mysqli_fetch_assoc($res)){
$response["error"] = false;
$response["message"] = "Password reset instructions have been sent to your email";
} else {
$response["error"] = True;
$response["message"] = "error";
}
echoRespnse(201, $response);
});
$app->run();
答
这可能是一种替代使用地图功能,而不是职位:
+0
这个工作,但没有通过参数获取参数 –
+0
试试var_dump($ _ POST);你看到任何结果? –
尝试** $电子邮件= $ APP->请求 - > getParam( '电子邮件'); ** –
请求没有达到那一点。它甚至在此之前发送404错误 –
你会写你的html表单吗? –