Home > Backend Development > PHP Tutorial > RESTful的PUT请求如何才能在控制器获取到数据,并为纯数组的形式?

RESTful的PUT请求如何才能在控制器获取到数据,并为纯数组的形式?

WBOY
Release: 2016-06-06 20:12:32
Original
985 people have browsed it

RESTful的PUT请求如何才能在控制器获取到数据,并为纯数组的形式?

回复内容:

RESTful的PUT请求如何才能在控制器获取到数据,并为纯数组的形式?

<code class="php">Yii::$app->request->bodyParams;</code>
Copy after login

file_get_contents("php://input");

<code>一般都是用`POST` 请求来模拟`PUT` 和`DELETE` 请求</code>
Copy after login

参数加 http_build_query($params)

curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template