Detecting request type in PHP (GET, POST, PUT or DELETE)

前端 未结 13 1433
不思量自难忘°
不思量自难忘° 2020-11-22 08:02

How can I detect which request type was used (GET, POST, PUT or DELETE) in PHP?

相关标签:
13条回答
  • 2020-11-22 08:34

    We can also use the input_filter to detect the request method while also providing security through input sanitation.

    $request = filter_input(INPUT_SERVER, 'REQUEST_METHOD', FILTER_SANITIZE_ENCODED);
    
    0 讨论(0)
提交回复
热议问题