Friday, October 26, 2018

http - 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?


Answer



By using



$_SERVER['REQUEST_METHOD']


Example




if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// The request is using the POST method
}


For more details please see the documentation for the $_SERVER variable.


No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...