How to detect HTTP method in CodeIgniter

前端 未结 3 1323
离开以前
离开以前 2020-12-28 13:04

How can I detect HTTP method in CodeIgniter controller class?

Edited: Is there any other way than using $_SERVER[\'REQUEST_METHOD\'] in

3条回答
  •  有刺的猬
    2020-12-28 13:33

    In CodeIgniter 3, you can use the method uhm...method of Input Class.

    From the docs:

    echo $this->input->method(TRUE); // Outputs: POST
    echo $this->input->method(FALSE); // Outputs: post
    echo $this->input->method(); // Outputs: post
    

提交回复
热议问题