How can I detect HTTP method in CodeIgniter controller class?
Edited:
Is there any other way than using $_SERVER['REQUEST_METHOD'] in CodeIgniter?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Thanks to Branden, I’ve found the answer.
$this->input->server($index)is identical to$_SERVER[$index].To get method you can use:
$this->input->server('REQUEST_METHOD').UPDATE: (thanks to Ecir Hana)
As of CodeIgniter 3, using of method is also possible: