删除方法 PHP

DELETE method PHP

我正在使用 php://input 来检索 POST/DELETE 方法中的参数。 问题是在 POST 请求中我可以使用 php://input 尽可能多的次数,而在 DELETE 方法中我只能使用它一次,之后这个 php://input returns空。

That's documented:

Note: Prior to PHP 5.6, a stream opened with php://input could only be read once; the stream did not support seek operations. However, depending on the SAPI implementation, it may be possible to open another php://input stream and restart reading. This is only possible if the request body data has been saved. Typically, this is the case for POST requests, but not other request methods, such as PUT or PROPFIND.