You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 4e48de9
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: user_guide_src/source/incoming/incomingrequest.rst
+44-14Lines changed: 44 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -100,37 +100,67 @@ With CodeIgniter's built-in methods you can simply do this:
100
100
Getting Data
101
101
============
102
102
103
-
getVar()
103
+
getGet()
104
104
--------
105
105
106
-
The ``getVar()`` method will pull from ``$_REQUEST``, so will return any data from ``$_GET``, ``$POST``, or ``$_COOKIE`` (depending on php.ini `request-order <https://www.php.net/manual/en/ini.core.php#ini.request-order>`_).
107
-
108
-
.. warning:: If you want to validate POST data only, don't use ``getVar()``.
109
-
Newer values override older values. POST values may be overridden by the
110
-
cookies if they have the same name, and you set "C" after "P" in
.. note:: If the incoming request has a ``Content-Type`` header set to ``application/json``,
114
-
the ``getVar()`` method returns the JSON data instead of ``$_REQUEST`` data.
108
+
* ``$request->getGet()``
115
109
116
-
get*()
117
-
------
110
+
getPost()
111
+
---------
118
112
119
-
While this
120
-
is convenient, you will often need to use a more specific method, like:
113
+
The ``getPost()`` method will pull from ``$_POST``.
121
114
122
-
* ``$request->getGet()``
123
115
* ``$request->getPost()``
116
+
117
+
getCookie()
118
+
-----------
119
+
120
+
The ``getCookie()`` method will pull from ``$_COOKIE``.
121
+
124
122
* ``$request->getCookie()``
123
+
124
+
getServer()
125
+
-----------
126
+
127
+
The ``getServer()`` method will pull from ``$_SERVER``.
128
+
125
129
* ``$request->getServer()``
130
+
131
+
getEnv()
132
+
--------
133
+
134
+
The ``getEnv()`` method will pull from ``$_ENV``.
135
+
126
136
* ``$request->getEnv()``
127
137
138
+
getPostGet()
139
+
------------
140
+
128
141
In addition, there are a few utility methods for retrieving information from either ``$_GET`` or ``$_POST``, while
129
142
maintaining the ability to control the order you look for it:
130
143
131
144
* ``$request->getPostGet()`` - checks ``$_POST`` first, then ``$_GET``
145
+
146
+
getGetPost()
147
+
------------
148
+
132
149
* ``$request->getGetPost()`` - checks ``$_GET`` first, then ``$_POST``
133
150
151
+
getVar()
152
+
--------
153
+
154
+
The ``getVar()`` method will pull from ``$_REQUEST``, so will return any data from ``$_GET``, ``$POST``, or ``$_COOKIE`` (depending on php.ini `request-order <https://www.php.net/manual/en/ini.core.php#ini.request-order>`_).
155
+
156
+
.. warning:: If you want to validate POST data only, don't use ``getVar()``.
157
+
Newer values override older values. POST values may be overridden by the
158
+
cookies if they have the same name, and you set "C" after "P" in
0 commit comments