How can I detect which request type was used (GET, POST, PUT or DELETE) in PHP?
转载于:https://stackoverflow.com/questions/359047/detecting-request-type-in-php-get-post-put-or-delete
How can I detect which request type was used (GET, POST, PUT or DELETE) in PHP?
转载于:https://stackoverflow.com/questions/359047/detecting-request-type-in-php-get-post-put-or-delete
By using
$_SERVER['REQUEST_METHOD']
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// The request is using the POST method
}
For more details please see the documentation for the $_SERVER variable.