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

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

WBOY
WBOYOriginal
2016-06-06 20:12:32982browse

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

回复内容:

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

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

file_get_contents("php://input");

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

参数加 http_build_query($params)

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

Statement:
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