Update User Guide

This commit is contained in:
kenjis 2023-11-09 23:17:38 +00:00
parent 3b9149883e
commit b6452db736
2 changed files with 147 additions and 107 deletions

View File

@ -439,7 +439,8 @@ uppercase version by wrapping the call in <code class="docutils literal notransl
</section>
<section id="retrieving-input">
<h2><a class="toc-backref" href="#id6">Retrieving Input</a><a class="headerlink" href="#retrieving-input" title="Permalink to this headline"></a></h2>
<p>You can retrieve input from <code class="docutils literal notranslate"><span class="pre">$_SERVER</span></code>, <code class="docutils literal notranslate"><span class="pre">$_GET</span></code>, <code class="docutils literal notranslate"><span class="pre">$_POST</span></code>, and <code class="docutils literal notranslate"><span class="pre">$_ENV</span></code> through the Request object.
<p>You can retrieve input from <code class="docutils literal notranslate"><span class="pre">$_GET</span></code>, <code class="docutils literal notranslate"><span class="pre">$_POST</span></code>, <code class="docutils literal notranslate"><span class="pre">$_COOKIE</span></code>, <code class="docutils literal notranslate"><span class="pre">$_SERVER</span></code>
and <code class="docutils literal notranslate"><span class="pre">$_ENV</span></code> through the Request object.
The data is not automatically filtered and returns the raw input data as passed in the request.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
@ -459,11 +460,68 @@ like this:</p>
<p>With CodeIgniters built-in methods you can simply do this:</p>
<div class="highlight-html+php notranslate"><div class="highlight"><pre><span></span><span class="o">&lt;?</span><span class="nx">php</span>
<span class="nv">$something</span> <span class="o">=</span> <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">getVar</span><span class="p">(</span><span class="s1">&#39;foo&#39;</span><span class="p">);</span>
<span class="nv">$something</span> <span class="o">=</span> <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">getPost</span><span class="p">(</span><span class="s1">&#39;foo&#39;</span><span class="p">);</span>
</pre></div>
</div>
<section id="getting-data">
<span id="incomingrequest-getting-data"></span><h3><a class="toc-backref" href="#id7">Getting Data</a><a class="headerlink" href="#getting-data" title="Permalink to this headline"></a></h3>
<section id="getget">
<h4>getGet()<a class="headerlink" href="#getget" title="Permalink to this headline"></a></h4>
<p>The <code class="docutils literal notranslate"><span class="pre">getGet()</span></code> method will pull from <code class="docutils literal notranslate"><span class="pre">$_GET</span></code>.</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">$request-&gt;getGet()</span></code></p></li>
</ul>
</section>
<section id="getpost">
<h4>getPost()<a class="headerlink" href="#getpost" title="Permalink to this headline"></a></h4>
<p>The <code class="docutils literal notranslate"><span class="pre">getPost()</span></code> method will pull from <code class="docutils literal notranslate"><span class="pre">$_POST</span></code>.</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">$request-&gt;getPost()</span></code></p></li>
</ul>
</section>
<section id="getcookie">
<h4>getCookie()<a class="headerlink" href="#getcookie" title="Permalink to this headline"></a></h4>
<p>The <code class="docutils literal notranslate"><span class="pre">getCookie()</span></code> method will pull from <code class="docutils literal notranslate"><span class="pre">$_COOKIE</span></code>.</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">$request-&gt;getCookie()</span></code></p></li>
</ul>
</section>
<section id="getserver">
<h4>getServer()<a class="headerlink" href="#getserver" title="Permalink to this headline"></a></h4>
<p>The <code class="docutils literal notranslate"><span class="pre">getServer()</span></code> method will pull from <code class="docutils literal notranslate"><span class="pre">$_SERVER</span></code>.</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">$request-&gt;getServer()</span></code></p></li>
</ul>
</section>
<section id="getenv">
<h4>getEnv()<a class="headerlink" href="#getenv" title="Permalink to this headline"></a></h4>
<p>The <code class="docutils literal notranslate"><span class="pre">getEnv()</span></code> method will pull from <code class="docutils literal notranslate"><span class="pre">$_ENV</span></code>.</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">$request-&gt;getEnv()</span></code></p></li>
</ul>
</section>
<section id="getpostget">
<h4>getPostGet()<a class="headerlink" href="#getpostget" title="Permalink to this headline"></a></h4>
<p>In addition, there are a few utility methods for retrieving information from either <code class="docutils literal notranslate"><span class="pre">$_GET</span></code> or <code class="docutils literal notranslate"><span class="pre">$_POST</span></code>, while
maintaining the ability to control the order you look for it:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">$request-&gt;getPostGet()</span></code> - checks <code class="docutils literal notranslate"><span class="pre">$_POST</span></code> first, then <code class="docutils literal notranslate"><span class="pre">$_GET</span></code></p></li>
</ul>
</section>
<section id="getgetpost">
<h4>getGetPost()<a class="headerlink" href="#getgetpost" title="Permalink to this headline"></a></h4>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">$request-&gt;getGetPost()</span></code> - checks <code class="docutils literal notranslate"><span class="pre">$_GET</span></code> first, then <code class="docutils literal notranslate"><span class="pre">$_POST</span></code></p></li>
</ul>
</section>
<section id="getvar">
<h4>getVar()<a class="headerlink" href="#getvar" title="Permalink to this headline"></a></h4>
<div class="admonition important">
<p class="admonition-title">Important</p>
<p>This method exists only for backward compatibility. Do not use it
in new projects. Even if you are already using it, we recommend that you use
another, more appropriate method.</p>
</div>
<p>The <code class="docutils literal notranslate"><span class="pre">getVar()</span></code> method will pull from <code class="docutils literal notranslate"><span class="pre">$_REQUEST</span></code>, so will return any data from <code class="docutils literal notranslate"><span class="pre">$_GET</span></code>, <code class="docutils literal notranslate"><span class="pre">$POST</span></code>, or <code class="docutils literal notranslate"><span class="pre">$_COOKIE</span></code> (depending on php.ini <a class="reference external" href="https://www.php.net/manual/en/ini.core.php#ini.request-order">request-order</a>).</p>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
@ -477,21 +535,7 @@ cookies if they have the same name, and you set “C” after “P” in
<p>If the incoming request has a <code class="docutils literal notranslate"><span class="pre">Content-Type</span></code> header set to <code class="docutils literal notranslate"><span class="pre">application/json</span></code>,
the <code class="docutils literal notranslate"><span class="pre">getVar()</span></code> method returns the JSON data instead of <code class="docutils literal notranslate"><span class="pre">$_REQUEST</span></code> data.</p>
</div>
<p>While this
is convenient, you will often need to use a more specific method, like:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">$request-&gt;getGet()</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">$request-&gt;getPost()</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">$request-&gt;getCookie()</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">$request-&gt;getServer()</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">$request-&gt;getEnv()</span></code></p></li>
</ul>
<p>In addition, there are a few utility methods for retrieving information from either <code class="docutils literal notranslate"><span class="pre">$_GET</span></code> or <code class="docutils literal notranslate"><span class="pre">$_POST</span></code>, while
maintaining the ability to control the order you look for it:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">$request-&gt;getPostGet()</span></code> - checks <code class="docutils literal notranslate"><span class="pre">$_POST</span></code> first, then <code class="docutils literal notranslate"><span class="pre">$_GET</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">$request-&gt;getGetPost()</span></code> - checks <code class="docutils literal notranslate"><span class="pre">$_GET</span></code> first, then <code class="docutils literal notranslate"><span class="pre">$_POST</span></code></p></li>
</ul>
</section>
</section>
<section id="getting-json-data">
<span id="incomingrequest-getting-json-data"></span><h3><a class="toc-backref" href="#id8">Getting JSON Data</a><a class="headerlink" href="#getting-json-data" title="Permalink to this headline"></a></h3>
@ -508,14 +552,12 @@ method if you know that youre expecting JSON.</p>
</div>
<p>By default, this will return any objects in the JSON data as objects. If you want that converted to associative
arrays, pass in <code class="docutils literal notranslate"><span class="pre">true</span></code> as the first parameter.</p>
<p>The second and third parameters match up to the <code class="docutils literal notranslate"><span class="pre">depth</span></code> and <code class="docutils literal notranslate"><span class="pre">options</span></code> arguments of the
<a class="reference external" href="https://www.php.net/manual/en/function.json-decode.php">json_decode</a> PHP function.</p>
<p>If the incoming request has a <code class="docutils literal notranslate"><span class="pre">Content-Type</span></code> header set to <code class="docutils literal notranslate"><span class="pre">application/json</span></code>, you can also use <code class="docutils literal notranslate"><span class="pre">getVar()</span></code> to get
the JSON stream. Using <code class="docutils literal notranslate"><span class="pre">getVar()</span></code> in this way will always return an object.</p>
<p>The second and third parameters match up to the <code class="docutils literal notranslate"><span class="pre">$depth</span></code> and <code class="docutils literal notranslate"><span class="pre">$flags</span></code> arguments of the
<a class="reference external" href="https://www.php.net/manual/en/function.json-decode.php">json_decode()</a> PHP function.</p>
</section>
<section id="getting-specific-data-from-json">
<h3><a class="toc-backref" href="#id9">Getting Specific Data from JSON</a><a class="headerlink" href="#getting-specific-data-from-json" title="Permalink to this headline"></a></h3>
<p>You can get a specific piece of data from a JSON stream by passing a variable name into <code class="docutils literal notranslate"><span class="pre">getVar()</span></code> for the
<p>You can get a specific piece of data from a JSON stream by passing a variable name into <code class="docutils literal notranslate"><span class="pre">getJsonVar()</span></code> for the
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.</p>
<div class="highlight-html+php notranslate"><div class="highlight"><pre><span></span><span class="o">&lt;?</span><span class="nx">php</span>
@ -529,16 +571,15 @@ data that you want or you can use “dot” notation to dig into the JSON to get
<span class="cm"> * }</span>
<span class="cm"> */</span>
<span class="nv">$data</span> <span class="o">=</span> <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">getVar</span><span class="p">(</span><span class="s1">&#39;foo&#39;</span><span class="p">);</span>
<span class="nv">$data</span> <span class="o">=</span> <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">getJsonVar</span><span class="p">(</span><span class="s1">&#39;foo&#39;</span><span class="p">);</span>
<span class="c1">// $data = &quot;bar&quot;</span>
<span class="nv">$data</span> <span class="o">=</span> <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">getVar</span><span class="p">(</span><span class="s1">&#39;fizz.buzz&#39;</span><span class="p">);</span>
<span class="nv">$data</span> <span class="o">=</span> <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">getJsonVar</span><span class="p">(</span><span class="s1">&#39;fizz.buzz&#39;</span><span class="p">);</span>
<span class="c1">// $data = &quot;baz&quot;</span>
</pre></div>
</div>
<p>If you want the result to be an associative array instead of an object, you can use <code class="docutils literal notranslate"><span class="pre">getJsonVar()</span></code> instead and pass
true in the second parameter. This function can also be used if you cant guarantee that the incoming request will have the
correct <code class="docutils literal notranslate"><span class="pre">Content-Type</span></code> header.</p>
<p>If you want the result to be an associative array instead of an object, you can
pass true in the second parameter:</p>
<div class="highlight-html+php notranslate"><div class="highlight"><pre><span></span><span class="o">&lt;?</span><span class="nx">php</span>
<span class="c1">// With the same request as above</span>
@ -618,7 +659,7 @@ filter types</a>.</p>
<p>Filtering a POST variable would look like this:</p>
<div class="highlight-html+php notranslate"><div class="highlight"><pre><span></span><span class="o">&lt;?</span><span class="nx">php</span>
<span class="nv">$email</span> <span class="o">=</span> <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">getVar</span><span class="p">(</span><span class="s1">&#39;email&#39;</span><span class="p">,</span> <span class="nx">FILTER_SANITIZE_EMAIL</span><span class="p">);</span>
<span class="nv">$email</span> <span class="o">=</span> <span class="nv">$request</span><span class="o">-&gt;</span><span class="na">getPost</span><span class="p">(</span><span class="s1">&#39;email&#39;</span><span class="p">,</span> <span class="nx">FILTER_SANITIZE_EMAIL</span><span class="p">);</span>
</pre></div>
</div>
<p>All of the methods mentioned above support the filter type passed in as the second parameter, with the
@ -834,10 +875,10 @@ multi-file upload, based on the filename given in the HTML file input:</p>
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>$index</strong> (<span><code class="xref php php-obj docutils literal notranslate"><span class="pre">string</span></code></span>) The name of the variable/key to look for.</p></li>
<li><p><strong>$filter</strong> (<span><code class="xref php php-obj docutils literal notranslate"><span class="pre">int</span></code></span>) The type of filter to apply. A list of filters can be found
<a class="reference external" href="https://www.php.net/manual/en/filter.filters.php">here</a>.</p></li>
<li><p><strong>$flags</strong> (<span><code class="xref php php-obj docutils literal notranslate"><span class="pre">int</span></code></span>) Flags to apply. A list of flags can be found
<a class="reference external" href="https://www.php.net/manual/en/filter.filters.flags.php">here</a>.</p></li>
<li><p><strong>$filter</strong> (<span><code class="xref php php-obj docutils literal notranslate"><span class="pre">int</span></code></span>) The type of filter to apply. A list of filters can be found in
<a class="reference external" href="https://www.php.net/manual/en/filter.filters.php">Types of filters</a>.</p></li>
<li><p><strong>$flags</strong> (<span><code class="xref php php-obj docutils literal notranslate"><span class="pre">int</span></code></span>) Flags to apply. A list of flags can be found in
<a class="reference external" href="https://www.php.net/manual/en/filter.filters.flags.php">Filter flags</a>.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
@ -847,44 +888,13 @@ multi-file upload, based on the filename given in the HTML file input:</p>
<dd class="field-odd"><p><span><code class="xref php php-obj docutils literal notranslate"><span class="pre">array|bool|float|int|object|string|null</span></code></span></p>
</dd>
</dl>
<p>The first parameter will contain the name of the REQUEST item you are looking for:</p>
<div class="highlight-html+php notranslate"><div class="highlight"><pre><span></span><span class="o">&lt;?</span><span class="nx">php</span>
<span class="nv">$request</span><span class="o">-&gt;</span><span class="na">getVar</span><span class="p">(</span><span class="s1">&#39;some_data&#39;</span><span class="p">);</span>
</pre></div>
</div>
<p>The method returns null if the item you are attempting to retrieve
does not exist.</p>
<p>The second optional parameter lets you run the data through the PHPs
filters. Pass in the desired filter type as the second parameter:</p>
<div class="highlight-html+php notranslate"><div class="highlight"><pre><span></span><span class="o">&lt;?</span><span class="nx">php</span>
<span class="nv">$request</span><span class="o">-&gt;</span><span class="na">getVar</span><span class="p">(</span><span class="s1">&#39;some_data&#39;</span><span class="p">,</span> <span class="nx">FILTER_SANITIZE_FULL_SPECIAL_CHARS</span><span class="p">);</span>
</pre></div>
</div>
<p>To return an array of all POST items call without any parameters.</p>
<p>To return all POST items and pass them through the filter, set the
first parameter to null while setting the second parameter to the filter
you want to use:</p>
<div class="highlight-html+php notranslate"><div class="highlight"><pre><span></span><span class="o">&lt;?</span><span class="nx">php</span>
<span class="nv">$request</span><span class="o">-&gt;</span><span class="na">getVar</span><span class="p">(</span><span class="k">null</span><span class="p">,</span> <span class="nx">FILTER_SANITIZE_FULL_SPECIAL_CHARS</span><span class="p">);</span>
<span class="c1">// returns all POST items with string sanitation</span>
</pre></div>
</div>
<p>To return an array of multiple POST parameters, pass all the required keys as an array:</p>
<div class="highlight-html+php notranslate"><div class="highlight"><pre><span></span><span class="o">&lt;?</span><span class="nx">php</span>
<span class="nv">$request</span><span class="o">-&gt;</span><span class="na">getVar</span><span class="p">([</span><span class="s1">&#39;field1&#39;</span><span class="p">,</span> <span class="s1">&#39;field2&#39;</span><span class="p">]);</span>
</pre></div>
</div>
<p>Same rule applied here, to retrieve the parameters with filtering, set the second parameter to
the filter type to apply:</p>
<div class="highlight-html+php notranslate"><div class="highlight"><pre><span></span><span class="o">&lt;?</span><span class="nx">php</span>
<span class="nv">$request</span><span class="o">-&gt;</span><span class="na">getVar</span><span class="p">([</span><span class="s1">&#39;field1&#39;</span><span class="p">,</span> <span class="s1">&#39;field2&#39;</span><span class="p">],</span> <span class="nx">FILTER_SANITIZE_FULL_SPECIAL_CHARS</span><span class="p">);</span>
</pre></div>
<div class="admonition important">
<p class="admonition-title">Important</p>
<p>This method exists only for backward compatibility. Do not use it
in new projects. Even if you are already using it, we recommend that you use
another, more appropriate method.</p>
</div>
<p>This method is identical to <code class="docutils literal notranslate"><span class="pre">getGet()</span></code>, only it fetches REQUEST data.</p>
</dd></dl>
<dl class="php method">
@ -894,10 +904,10 @@ the filter type to apply:</p>
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>$index</strong> (<span><code class="xref php php-obj docutils literal notranslate"><span class="pre">string</span></code></span>) The name of the variable/key to look for.</p></li>
<li><p><strong>$filter</strong> (<span><code class="xref php php-obj docutils literal notranslate"><span class="pre">int</span></code></span>) The type of filter to apply. A list of filters can be
found <a class="reference external" href="https://www.php.net/manual/en/filter.filters.php">here</a>.</p></li>
<li><p><strong>$flags</strong> (<span><code class="xref php php-obj docutils literal notranslate"><span class="pre">int</span></code></span>) Flags to apply. A list of flags can be found
<a class="reference external" href="https://www.php.net/manual/en/filter.filters.flags.php">here</a>.</p></li>
<li><p><strong>$filter</strong> (<span><code class="xref php php-obj docutils literal notranslate"><span class="pre">int</span></code></span>) The type of filter to apply. A list of filters can be found in
<a class="reference external" href="https://www.php.net/manual/en/filter.filters.php">Types of filters</a>.</p></li>
<li><p><strong>$flags</strong> (<span><code class="xref php php-obj docutils literal notranslate"><span class="pre">int</span></code></span>) Flags to apply. A list of flags can be found in
<a class="reference external" href="https://www.php.net/manual/en/filter.filters.flags.php">Filter flags</a>.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
@ -907,7 +917,44 @@ found <a class="reference external" href="https://www.php.net/manual/en/filter.f
<dd class="field-odd"><p><span><code class="xref php php-obj docutils literal notranslate"><span class="pre">array|bool|float|int|object|string|null</span></code></span></p>
</dd>
</dl>
<p>This method is identical to <code class="docutils literal notranslate"><span class="pre">getVar()</span></code>, only it fetches GET data.</p>
<p>The first parameter will contain the name of the GET item you are looking for:</p>
<div class="highlight-html+php notranslate"><div class="highlight"><pre><span></span><span class="o">&lt;?</span><span class="nx">php</span>
<span class="nv">$request</span><span class="o">-&gt;</span><span class="na">getGet</span><span class="p">(</span><span class="s1">&#39;some_data&#39;</span><span class="p">);</span>
</pre></div>
</div>
<p>The method returns null if the item you are attempting to retrieve
does not exist.</p>
<p>The second optional parameter lets you run the data through the PHPs
filters. Pass in the desired filter type as the second parameter:</p>
<div class="highlight-html+php notranslate"><div class="highlight"><pre><span></span><span class="o">&lt;?</span><span class="nx">php</span>
<span class="nv">$request</span><span class="o">-&gt;</span><span class="na">getGet</span><span class="p">(</span><span class="s1">&#39;some_data&#39;</span><span class="p">,</span> <span class="nx">FILTER_SANITIZE_FULL_SPECIAL_CHARS</span><span class="p">);</span>
</pre></div>
</div>
<p>To return an array of all GET items call without any parameters.</p>
<p>To return all GET items and pass them through the filter, set the
first parameter to null while setting the second parameter to the filter
you want to use:</p>
<div class="highlight-html+php notranslate"><div class="highlight"><pre><span></span><span class="o">&lt;?</span><span class="nx">php</span>
<span class="nv">$request</span><span class="o">-&gt;</span><span class="na">getGet</span><span class="p">(</span><span class="k">null</span><span class="p">,</span> <span class="nx">FILTER_SANITIZE_FULL_SPECIAL_CHARS</span><span class="p">);</span>
<span class="c1">// returns all GET items with string sanitation</span>
</pre></div>
</div>
<p>To return an array of multiple GET parameters, pass all the required keys as an array:</p>
<div class="highlight-html+php notranslate"><div class="highlight"><pre><span></span><span class="o">&lt;?</span><span class="nx">php</span>
<span class="nv">$request</span><span class="o">-&gt;</span><span class="na">getGet</span><span class="p">([</span><span class="s1">&#39;field1&#39;</span><span class="p">,</span> <span class="s1">&#39;field2&#39;</span><span class="p">]);</span>
</pre></div>
</div>
<p>Same rule applied here, to retrieve the parameters with filtering, set the second parameter to
the filter type to apply:</p>
<div class="highlight-html+php notranslate"><div class="highlight"><pre><span></span><span class="o">&lt;?</span><span class="nx">php</span>
<span class="nv">$request</span><span class="o">-&gt;</span><span class="na">getGet</span><span class="p">([</span><span class="s1">&#39;field1&#39;</span><span class="p">,</span> <span class="s1">&#39;field2&#39;</span><span class="p">],</span> <span class="nx">FILTER_SANITIZE_FULL_SPECIAL_CHARS</span><span class="p">);</span>
</pre></div>
</div>
</dd></dl>
<dl class="php method">
@ -927,11 +974,10 @@ found <a class="reference external" href="https://www.php.net/manual/en/filter.f
<dd class="field-even"><p><code class="docutils literal notranslate"><span class="pre">$_POST</span></code> if no parameters supplied, otherwise the POST value if found, or null if not</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><p>array|bool|float|int|object|string|null</p>
<p>This method is identical to <code class="docutils literal notranslate"><span class="pre">getVar()</span></code>, only it fetches POST data.</p>
</p>
<dd class="field-odd"><p><span><code class="xref php php-obj docutils literal notranslate"><span class="pre">array|bool|float|int|object|string|null</span></code></span></p>
</dd>
</dl>
<p>This method is identical to <code class="docutils literal notranslate"><span class="pre">getGet()</span></code>, only it fetches POST data.</p>
</dd></dl>
<dl class="php method">
@ -941,10 +987,10 @@ found <a class="reference external" href="https://www.php.net/manual/en/filter.f
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>$index</strong> (<span><code class="xref php php-obj docutils literal notranslate"><span class="pre">string</span></code></span>) The name of the variable/key to look for.</p></li>
<li><p><strong>$filter</strong> (<span><code class="xref php php-obj docutils literal notranslate"><span class="pre">int</span></code></span>) The type of filter to apply. A list of filters can be
found <a class="reference external" href="https://www.php.net/manual/en/filter.filters.php">here</a>.</p></li>
<li><p><strong>$flags</strong> (<span><code class="xref php php-obj docutils literal notranslate"><span class="pre">int</span></code></span>) Flags to apply. A list of flags can be found
<a class="reference external" href="https://www.php.net/manual/en/filter.filters.flags.php">here</a>.</p></li>
<li><p><strong>$filter</strong> (<span><code class="xref php php-obj docutils literal notranslate"><span class="pre">int</span></code></span>) The type of filter to apply. A list of filters can be found in
<a class="reference external" href="https://www.php.net/manual/en/filter.filters.php">Types of filters</a>.</p></li>
<li><p><strong>$flags</strong> (<span><code class="xref php php-obj docutils literal notranslate"><span class="pre">int</span></code></span>) Flags to apply. A list of flags can be found in
<a class="reference external" href="https://www.php.net/manual/en/filter.filters.flags.php">Filter flags</a>.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
@ -974,10 +1020,10 @@ Although POST data will be preferred in case of name conflict.</p>
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>$index</strong> (<span><code class="xref php php-obj docutils literal notranslate"><span class="pre">string</span></code></span>) The name of the variable/key to look for.</p></li>
<li><p><strong>$filter</strong> (<span><code class="xref php php-obj docutils literal notranslate"><span class="pre">int</span></code></span>) The type of filter to apply. A list of filters can be
found <a class="reference external" href="https://www.php.net/manual/en/filter.filters.php">here</a>.</p></li>
<li><p><strong>$flags</strong> (<span><code class="xref php php-obj docutils literal notranslate"><span class="pre">int</span></code></span>) Flags to apply. A list of flags can be found
<a class="reference external" href="https://www.php.net/manual/en/filter.filters.flags.php">here</a>.</p></li>
<li><p><strong>$filter</strong> (<span><code class="xref php php-obj docutils literal notranslate"><span class="pre">int</span></code></span>) The type of filter to apply. A list of filters can be found in
<a class="reference external" href="https://www.php.net/manual/en/filter.filters.php">Types of filters</a>.</p></li>
<li><p><strong>$flags</strong> (<span><code class="xref php php-obj docutils literal notranslate"><span class="pre">int</span></code></span>) Flags to apply. A list of flags can be found in
<a class="reference external" href="https://www.php.net/manual/en/filter.filters.flags.php">Filter flags</a>.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
@ -1007,10 +1053,10 @@ Although GET data will be preferred in case of name conflict.</p>
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>$index</strong> (<span><code class="xref php php-obj docutils literal notranslate"><span class="pre">array|string|null</span></code></span>) COOKIE name</p></li>
<li><p><strong>$filter</strong> (<span><code class="xref php php-obj docutils literal notranslate"><span class="pre">int</span></code></span>) The type of filter to apply. A list of filters can be
found <a class="reference external" href="https://www.php.net/manual/en/filter.filters.php">here</a>.</p></li>
<li><p><strong>$flags</strong> (<span><code class="xref php php-obj docutils literal notranslate"><span class="pre">int</span></code></span>) Flags to apply. A list of flags can be found
<a class="reference external" href="https://www.php.net/manual/en/filter.filters.flags.php">here</a>.</p></li>
<li><p><strong>$filter</strong> (<span><code class="xref php php-obj docutils literal notranslate"><span class="pre">int</span></code></span>) The type of filter to apply. A list of filters can be found in
<a class="reference external" href="https://www.php.net/manual/en/filter.filters.php">Types of filters</a>.</p></li>
<li><p><strong>$flags</strong> (<span><code class="xref php php-obj docutils literal notranslate"><span class="pre">int</span></code></span>) Flags to apply. A list of flags can be found in
<a class="reference external" href="https://www.php.net/manual/en/filter.filters.flags.php">Filter flags</a>.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
@ -1048,10 +1094,10 @@ your configured <code class="docutils literal notranslate"><span class="pre">Con
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>$index</strong> (<span><code class="xref php php-obj docutils literal notranslate"><span class="pre">array|string|null</span></code></span>) Value name</p></li>
<li><p><strong>$filter</strong> (<span><code class="xref php php-obj docutils literal notranslate"><span class="pre">int</span></code></span>) The type of filter to apply. A list of filters can be
found <a class="reference external" href="https://www.php.net/manual/en/filter.filters.php">here</a>.</p></li>
<li><p><strong>$flags</strong> (<span><code class="xref php php-obj docutils literal notranslate"><span class="pre">int</span></code></span>) Flags to apply. A list of flags can be found
<a class="reference external" href="https://www.php.net/manual/en/filter.filters.flags.php">here</a>.</p></li>
<li><p><strong>$filter</strong> (<span><code class="xref php php-obj docutils literal notranslate"><span class="pre">int</span></code></span>) The type of filter to apply. A list of filters can be found in
<a class="reference external" href="https://www.php.net/manual/en/filter.filters.php">Types of filters</a>.</p></li>
<li><p><strong>$flags</strong> (<span><code class="xref php php-obj docutils literal notranslate"><span class="pre">int</span></code></span>) Flags to apply. A list of flags can be found in
<a class="reference external" href="https://www.php.net/manual/en/filter.filters.flags.php">Filter flags</a>.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
@ -1062,7 +1108,7 @@ found <a class="reference external" href="https://www.php.net/manual/en/filter.f
</dd>
</dl>
<p>This method is identical to the <code class="docutils literal notranslate"><span class="pre">getPost()</span></code>, <code class="docutils literal notranslate"><span class="pre">getGet()</span></code> and <code class="docutils literal notranslate"><span class="pre">getCookie()</span></code>
methods, only it fetches getServer data (<code class="docutils literal notranslate"><span class="pre">$_SERVER</span></code>):</p>
methods, only it fetches Server data (<code class="docutils literal notranslate"><span class="pre">$_SERVER</span></code>):</p>
<div class="highlight-html+php notranslate"><div class="highlight"><pre><span></span><span class="o">&lt;?</span><span class="nx">php</span>
<span class="nv">$request</span><span class="o">-&gt;</span><span class="na">getServer</span><span class="p">(</span><span class="s1">&#39;some_data&#39;</span><span class="p">);</span>
@ -1079,22 +1125,16 @@ as an array.</p>
<dl class="php method">
<dt class="sig sig-object php" id="CodeIgniter\HTTP\IncomingRequest::getUserAgent">
<span class="sig-name descname"><span class="pre">getUserAgent</span></span><span class="sig-paren">(</span><span class="optional">[</span><em class="sig-param"><span class="pre">$filter</span> <span class="pre">=</span> <span class="pre">null</span></em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#CodeIgniter\HTTP\IncomingRequest::getUserAgent" title="Permalink to this definition"></a></dt>
<span class="sig-name descname"><span class="pre">getUserAgent</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#CodeIgniter\HTTP\IncomingRequest::getUserAgent" title="Permalink to this definition"></a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>$filter</strong> (<span><code class="xref php php-obj docutils literal notranslate"><span class="pre">int</span></code></span>) The type of filter to apply. A list of filters can be
found <a class="reference external" href="https://www.php.net/manual/en/filter.filters.php">here</a>.</p></li>
</ul>
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>The User Agent string, as found in the SERVER data, or null if not found.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The User Agent string, as found in the SERVER data, or null if not found.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><span><a class="reference internal" href="../libraries/user_agent.html#CodeIgniter\HTTP\UserAgent" title="CodeIgniter\HTTP\UserAgent"><code class="xref php php-obj docutils literal notranslate"><span class="pre">CodeIgniter\HTTP\UserAgent</span></code></a></span></p>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p><span><a class="reference internal" href="../libraries/user_agent.html#CodeIgniter\HTTP\UserAgent" title="CodeIgniter\HTTP\UserAgent"><code class="xref php php-obj docutils literal notranslate"><span class="pre">CodeIgniter\HTTP\UserAgent</span></code></a></span></p>
</dd>
</dl>
<p>This method returns the User Agent string from the SERVER data:</p>
<p>This method returns the User Agent instance from the SERVER data:</p>
<div class="highlight-html+php notranslate"><div class="highlight"><pre><span></span><span class="o">&lt;?</span><span class="nx">php</span>
<span class="nv">$request</span><span class="o">-&gt;</span><span class="na">getUserAgent</span><span class="p">();</span>

File diff suppressed because one or more lines are too long