小编alf*_*ega的帖子

为什么POST请求返回404

我在PHP中有以下代码片段:

if (strcasecmp($_POST['method'], 'assignId') == 0) {
$username = $_POST['username'];

$response['code'] = 1;
$response['status'] = $api_response_code[$response['code']]['HTTP Response'];
$sql = "CALL new_person('$username')";

if (($result = $conn->query($sql)) === TRUE) {
    $row = $result->fetch_assoc();
    $response['data'] = $row;
}
deliver_response($response);
Run Code Online (Sandbox Code Playgroud)

new_person是一个存储过程,它返回一个id,它已经过测试,可以正常工作并deliver_response返回输入的JSON格式。它也已经过测试,可以正常工作。

为什么POST请求返回404错误?

存储过程正在执行,但不会返回结果。最后,当我将POST方法更改为GET并发出get请求时,它可以正常工作!

php http-post http-status-code-404

5
推荐指数
1
解决办法
6066
查看次数

标签 统计

http-post ×1

http-status-code-404 ×1

php ×1