File tree Expand file tree Collapse file tree 1 file changed +0
-24
lines changed
Expand file tree Collapse file tree 1 file changed +0
-24
lines changed Original file line number Diff line number Diff line change @@ -327,30 +327,6 @@ a setter for environment variables without having to modify globals
327327$this->request->withEnv('REQUEST_METHOD', 'POST');
328328```
329329
330- ### Reading XML and JSON Payloads
331-
332- Applications employing [ REST] ( ../development/rest ) often exchange data in
333- non-URL-encoded post bodies. You can read input data in any format using
334- ` Cake\Http\ServerRequest::input() ` . By providing a decoding function,
335- you can receive the content in a deserialized format:
336-
337- Some deserializing methods require additional parameters when called, such as
338- the 'as array' parameter on ` json_decode ` . If you want XML converted into a
339- DOMDocument object, ` Cake\Http\ServerRequest::input() ` supports
340- passing additional parameters as well:
341-
342- ::: code-group
343-
344- ``` php [JSON]
345- // Get JSON-encoded data submitted to a PUT/POST action
346- $jsonData = $this->request->input('json_decode');
347- ```
348-
349- ``` php [XML]
350- // Get XML-encoded data submitted to a PUT/POST action
351- $data = $this->request->input('Cake\Utility\Xml::build', ['return' => 'domdocument']);
352- ```
353-
354330:::
355331
356332### Path Information
You can’t perform that action at this time.
0 commit comments