Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into 4.4
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Feb 13, 2023
2 parents 2114443 + 4a4f55b commit c53aef0
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 18 deletions.
18 changes: 9 additions & 9 deletions user_guide_src/source/general/environments.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ The simplest method to set the variable is in your :doc:`.env file </general/con
Apache
------

This server variable can be set in your ``.htaccess`` file or Apache
config using `SetEnv <https://httpd.apache.org/docs/2.2/mod/mod_env.html#setenv>`_.
This server variable can be set in your **.htaccess** file or Apache
config using `SetEnv <https://httpd.apache.org/docs/2.4/mod/mod_env.html#setenv>`_.

.. code-block:: apache
Expand All @@ -58,11 +58,11 @@ config using `SetEnv <https://httpd.apache.org/docs/2.2/mod/mod_env.html#setenv>
.. _environment-nginx:

nginx
Nginx
-----

Under nginx, you must pass the environment variable through the ``fastcgi_params``
in order for it to show up under the `$_SERVER` variable. This allows it to work on the
Under Nginx, you must pass the environment variable through the ``fastcgi_params``
in order for it to show up under the ``$_SERVER`` variable. This allows it to work on the
virtual-host level, instead of using `env` to set it for the entire server, though that
would work fine on a dedicated server. You would then modify your server config to something
like:
Expand All @@ -80,7 +80,7 @@ like:
}
}
Alternative methods are available for nginx and other servers, or you can
Alternative methods are available for Nginx and other servers, or you can
remove this logic entirely and set the constant based on the server's IP address
(for instance).

Expand All @@ -102,17 +102,17 @@ a fresh install:
* production.php
* testing.php

Effects On Default Framework Behavior
Effects on Default Framework Behavior
=====================================

There are some places in the CodeIgniter system where the ENVIRONMENT
There are some places in the CodeIgniter system where the ``ENVIRONMENT``
constant is used. This section describes how default framework behavior
is affected.

Error Reporting
---------------

Setting the ENVIRONMENT constant to a value of ``development`` will cause
Setting the ``ENVIRONMENT`` constant to a value of ``development`` will cause
all PHP errors to be rendered to the browser when they occur.
Conversely, setting the constant to ``production`` will disable all error
output. Disabling error reporting in production is a
Expand Down
35 changes: 28 additions & 7 deletions user_guide_src/source/libraries/uri.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@ The Current URI
---------------

Many times, all you really want is an object representing the current URL of this request.
You can use one of the functions available in the **url_helper**:
You can use one of the functions available in the :doc:`../helpers/url_helper`:

.. literalinclude:: uri/004.php

You must pass ``true`` as the first parameter, otherwise, it will return the string representation of the current URL.

This URI is based on the path (relative to your ``baseURL``) as determined by the current request object and
your settings in ``Config\App`` (baseURL, indexPage, and forceGlobalSecureRequests).
your settings in ``Config\App`` (``baseURL``, ``indexPage``, and ``forceGlobalSecureRequests``).
Assuming that you're in a controller that extends ``CodeIgniter\Controller`` you can get this relative path:

.. literalinclude:: uri/005.php
Expand Down Expand Up @@ -95,7 +96,7 @@ If you do not want to display the port, pass in ``true`` as the only parameter:

.. note:: If the current port is the default port for the scheme it will never be displayed.

Userinfo
UserInfo
--------

The userinfo section is simply the username and password that you might see with an FTP URI. While you can get
Expand Down Expand Up @@ -138,31 +139,51 @@ can be used to manipulate it:
Query
-----

The query variables can be manipulated through the class using simple string representations. Query values can only
The query data can be manipulated through the class using simple string representations.

Getting/Setting Query
^^^^^^^^^^^^^^^^^^^^^

Query values can only
be set as a string currently.

.. literalinclude:: uri/017.php

The ``setQuery()`` method overwrite any existing query variables.

.. note:: Query values cannot contain fragments. An InvalidArgumentException will be thrown if it does.

Setting Query from Array
^^^^^^^^^^^^^^^^^^^^^^^^

You can set query values using an array:

.. literalinclude:: uri/018.php

The ``setQuery()`` and ``setQueryArray()`` methods overwrite any existing query variables. You can add a value to the
The ``setQueryArray()`` method overwrite any existing query variables.

Adding Query Value
^^^^^^^^^^^^^^^^^^

You can add a value to the
query variables collection without destroying the existing query variables with the ``addQuery()`` method. The first
parameter is the name of the variable, and the second parameter is the value:

.. literalinclude:: uri/019.php

**Filtering Query Values**
Filtering Query Values
^^^^^^^^^^^^^^^^^^^^^^

You can filter the query values returned by passing an options array to the ``getQuery()`` method, with either an
*only* or an *except* key:

.. literalinclude:: uri/020.php

This only changes the values returned during this one call. If you need to modify the URI's query values more permanently,

Changing Query Values
^^^^^^^^^^^^^^^^^^^^^

you can use the ``stripQuery()`` and ``keepQuery()`` methods to change the actual object's query variable collection:

.. literalinclude:: uri/021.php
Expand All @@ -174,7 +195,7 @@ you can use the ``stripQuery()`` and ``keepQuery()`` methods to change the actua
Fragment
--------

Fragments are the portion at the end of the URL, preceded by the pound-sign (#). In HTML URLs these are links
Fragments are the portion at the end of the URL, preceded by the pound-sign (``#``). In HTML URLs these are links
to an on-page anchor. Media URI's can make use of them in various other ways.

.. literalinclude:: uri/022.php
Expand Down
4 changes: 2 additions & 2 deletions user_guide_src/source/libraries/uri/016.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

$uri = new \CodeIgniter\HTTP\URI('http://www.example.com/some/path');

echo $uri->getPath(); // 'some/path'
echo $uri->setPath('another/path')->getPath(); // 'another/path'
echo $uri->getPath(); // '/some/path'
echo $uri->setPath('/another/path')->getPath(); // '/another/path'

0 comments on commit c53aef0

Please sign in to comment.