如何从控制器中的POST请求接收数据?我不用树枝.
public function newAction(Request $request)
{
//when I use
$content = $request->getContent();
// as result I see "string" with need field and value. It's not json
// array
// value like
/*
string '------WebKitFormBoundaryI12ukQBs3HdmPjvh
Content-Disposition: form-data; name="title"
"valuefortitle"
------WebKitFormBoundaryI12ukQBs3HdmPjvh
Content-Disposition: form-data; name="name"
"supername"
------WebKitFormBoundaryI12ukQBs3HdmPjvh--
' (length=253)
*/
}
Run Code Online (Sandbox Code Playgroud)
或者我如何序列化(转换)将数据发布到对象或数组
我使用Postman发送请求,标题为"Content-Type:application/json".
你能告诉我如何保存文件(图像)吗?