$method = $_SERVER['REQUEST_METHOD']
if ($method == 'POST') {
// Method is POST
} elseif ($method == 'GET') {
// Method is GET
} elseif ($method == 'PUT') {
// Method is PUT
} elseif ($method == 'DELETE') {
// Method is DELETE
} else {
// Method unknown
}
Way to use PUT data from PHP:$method = $_SERVER['REQUEST_METHOD']; if ('PUT' === $method) { parse_str(file_get_contents('php://input'), $_PUT); var_dump($_PUT); //$_PUT contains put fields }
Komentarų nėra:
Rašyti komentarą