Get PATCH request data in PHP

前端 未结 4 1486
無奈伤痛
無奈伤痛 2020-12-16 12:08

I need to make a PATCH request to a PHP application.

How can I get the data from that PATCH request inside that application?

If I h

4条回答
  •  北海茫月
    2020-12-16 12:50

    I know that this has been solved, but for anyone who was hoping for an answer like

    $_PATCH["name"];
    

    there is a way to do that:

    parse_str(file_get_contents('php://input'), $_PATCH);
    

    then you can access it like $_GET["something"] and $_POST["something"] just do

    $_PATCH["something"]
    

    hope that helped someone :)

提交回复
热议问题