如何使用 HttpFoundation 组件(没有 Symfony)获取PUT正文参数?根据文档Request::createFromGlobals仅关于 POST、GET ... 但不是 PUT。所以在这里我不能使用 like $request->request->all(),它将是空的。
我相信有一个更好的方法
$request = Request::createFromGlobals;
$content = $request->getContent();
// Parsing $content
这种方式json_decode($request->getContent(), true);返回null。
请分享你的经验。