Skip to content

Commit 099a884

Browse files
committed
docs: replace getVar() with getJsonVar()
getVar() is not recommended.
1 parent 1e07684 commit 099a884

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

‎user_guide_src/source/incoming/incomingrequest.rst‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,14 +182,13 @@ The second and third parameters match up to the ``$depth`` and ``$flags`` argume
182182
Getting Specific Data from JSON
183183
===============================
184184

185-
You can get a specific piece of data from a JSON stream by passing a variable name into ``getVar()`` for the
185+
You can get a specific piece of data from a JSON stream by passing a variable name into ``getJsonVar()`` for the
186186
data that you want or you can use "dot" notation to dig into the JSON to get data that is not on the root level.
187187

188188
.. literalinclude:: incomingrequest/010.php
189189

190-
If you want the result to be an associative array instead of an object, you can use ``getJsonVar()`` instead and pass
191-
true in the second parameter. This function can also be used if you can't guarantee that the incoming request will have the
192-
correct ``Content-Type`` header.
190+
If you want the result to be an associative array instead of an object, you can
191+
pass true in the second parameter:
193192

194193
.. literalinclude:: incomingrequest/011.php
195194

‎user_guide_src/source/incoming/incomingrequest/010.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
* }
1111
*/
1212

13-
$data = $request->getVar('foo');
13+
$data = $request->getJsonVar('foo');
1414
// $data = "bar"
1515

16-
$data = $request->getVar('fizz.buzz');
16+
$data = $request->getJsonVar('fizz.buzz');
1717
// $data = "baz"

0 commit comments

Comments
 (0)