file_get_contents('php://input') always returns an empty string

后端 未结 12 2235
遥遥无期
遥遥无期 2020-12-09 09:04

I\'m building a PHP RESTful API, following this tutorial. The following function, which should return the data sent with the request when the \'put\' method is used, returns

12条回答
  •  悲&欢浪女
    2020-12-09 09:52

    I see the problem,

    You need to add filename.php in the end of the request url or need to rewrite the server rules in .htaccess file to get around this.

    curl -i -X PUT -d '{"address":"Sunset Boulevard"}' http://localhost/clients/ryan/{filename.php}
    

    replace {filename.php} with appropriate file name. :)

提交回复
热议问题