mirror of
https://github.com/codeigniter4/CodeIgniter4.git
synced 2025-02-20 11:44:28 +08:00
Merge pull request #852 from natanfelles/userguide
Update some userguide titles, code-blocks, tables...
This commit is contained in:
commit
e4662f9cd0
@ -8,14 +8,16 @@ can change to meet the needs of your application.
|
||||
Default Directories
|
||||
===================
|
||||
|
||||
A fresh install has six directories: ``/application``, ``/system``, ``/public``,
|
||||
``/writable``, ``/tests`` and ``/docs``.
|
||||
A fresh install has six directories: ``/application``, ``/system``, ``/public``,
|
||||
``/writable``, ``/tests`` and ``/docs``.
|
||||
Each of these directories has a very specific part to play.
|
||||
|
||||
application
|
||||
-----------
|
||||
The ``application`` directory is where all of your application code lives. This comes with a default directory
|
||||
structure that works well for many applications. The following folders make up the basic contents::
|
||||
structure that works well for many applications. The following folders make up the basic contents:
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
/application
|
||||
/Config Stores the configuration files
|
||||
@ -51,7 +53,7 @@ public
|
||||
|
||||
The **public** folder holds the browser-accessible portion of your web application,
|
||||
preventing direct access to your source code.
|
||||
It contains the main **.htaccess** file, **index.php**, and any application
|
||||
It contains the main **.htaccess** file, **index.php**, and any application
|
||||
assets that you add, like CSS, javascript, or
|
||||
images.
|
||||
|
||||
@ -80,8 +82,8 @@ User Guide, and the ``api_docs`` subfolder contains a local copy of the CodeIgni
|
||||
Modifying Directory Locations
|
||||
-----------------------------
|
||||
|
||||
If you've relocated any of the main directories, you can let the application
|
||||
If you've relocated any of the main directories, you can let the application
|
||||
know the new location within the main ``index.php`` file.
|
||||
|
||||
Starting around line 50, you will find three variables that hold the location to the **application**,
|
||||
**system**, and **writable** directories. These paths are relative to **index.php**.
|
||||
**system**, and **writable** directories. These paths are relative to **index.php**.
|
||||
|
@ -271,7 +271,7 @@ Date Mutators
|
||||
-------------
|
||||
|
||||
By default, the Entity class will convert fields named `created_at`, `updated_at`, or `deleted_at` into
|
||||
:doc:`Time </libraries/time>`_ instances whenever they are set or retrieved. The Time class provides a large number
|
||||
:doc:`Time </libraries/time>` instances whenever they are set or retrieved. The Time class provides a large number
|
||||
of helpful methods in a immutable, localized way.
|
||||
|
||||
You can define which properties are automatically converted by adding the name to the **options['dates']** array::
|
||||
|
@ -181,8 +181,7 @@ below is for MySQL.
|
||||
|
||||
|
||||
Adding Foreign Keys
|
||||
===========
|
||||
|
||||
===================
|
||||
|
||||
::
|
||||
|
||||
@ -245,7 +244,7 @@ Execute a DROP TABLE statement and optionally add an IF EXISTS clause.
|
||||
$forge->dropTable('table_name',TRUE);
|
||||
|
||||
Dropping a Foreign Key
|
||||
================
|
||||
======================
|
||||
|
||||
Execute a DROP FOREIGN KEY.
|
||||
|
||||
|
@ -19,7 +19,9 @@ the value provided in ``$_SERVER['CI_ENVIRONMENT']``, otherwise defaulting to
|
||||
.env
|
||||
----
|
||||
|
||||
The simplest method to set the variable is in your :doc:`.env file </general/configuration>`::
|
||||
The simplest method to set the variable is in your :doc:`.env file </general/configuration>`.
|
||||
|
||||
.. code-block:: ini
|
||||
|
||||
CI_ENVIRONMENT = development
|
||||
|
||||
@ -28,7 +30,8 @@ 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>`_.
|
||||
::
|
||||
|
||||
.. code-block:: apache
|
||||
|
||||
SetEnv CI_ENVIRONMENT development
|
||||
|
||||
@ -39,7 +42,9 @@ 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::
|
||||
like:
|
||||
|
||||
.. code-block:: nginx
|
||||
|
||||
server {
|
||||
server_name localhost;
|
||||
@ -87,7 +92,7 @@ Error Reporting
|
||||
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
|
||||
output. Disabling error reporting in production is a
|
||||
:doc:`good security practice </concepts/security>`.
|
||||
|
||||
Configuration Files
|
||||
|
@ -38,7 +38,9 @@ Apache Web Server
|
||||
|
||||
Apache must have the *mod_rewrite* extension enabled. If it does, you can use a ``.htaccess`` file with some simple rules.
|
||||
Here is an example of such a file, using the "negative" method in which everything is redirected except the specified
|
||||
items::
|
||||
items:
|
||||
|
||||
.. code-block:: apache
|
||||
|
||||
RewriteEngine On
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
@ -56,7 +58,9 @@ NGINX
|
||||
-----
|
||||
|
||||
Under NGINX, you can define a location block and use the ``try_files`` directive to get the same effect as we did with
|
||||
the above Apache configuration::
|
||||
the above Apache configuration:
|
||||
|
||||
.. code-block:: nginx
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php/$args;
|
||||
|
@ -97,9 +97,9 @@ Several options can be passed to the ``render()`` or ``renderString()`` methods:
|
||||
ignored for renderString()
|
||||
- ``saveData`` - true if the view data parameters should be retained for subsequent calls
|
||||
|
||||
***************
|
||||
|
||||
Class Reference
|
||||
***************
|
||||
---------------
|
||||
|
||||
.. php:class:: CodeIgniter\\View\\View
|
||||
|
||||
|
@ -5,7 +5,7 @@ Security Helper
|
||||
The Security Helper file contains security related functions.
|
||||
|
||||
.. contents::
|
||||
:local:
|
||||
:local:
|
||||
|
||||
Loading this Helper
|
||||
===================
|
||||
|
@ -154,7 +154,7 @@ every line after the first line, so that you will have a crisp column edge on th
|
||||
|
||||
Would create something like this:
|
||||
|
||||
.. code-block:: txt
|
||||
.. code-block:: none
|
||||
|
||||
task1a Lorem Ipsum is simply dummy
|
||||
text of the printing and typesetting
|
||||
@ -181,7 +181,7 @@ this::
|
||||
If you have a long-running task that you would like to keep the user updated with the progress, you can use the
|
||||
``showProgress()`` method which displays something like the following:
|
||||
|
||||
.. code-block:: txt
|
||||
.. code-block:: none
|
||||
|
||||
[####......] 40% Complete
|
||||
|
||||
@ -216,7 +216,7 @@ pass ``false`` as the first parameter and the progress bar will be removed.
|
||||
|
||||
CLI::table($tbody, $thead);
|
||||
|
||||
.. code-block:: txt
|
||||
.. code-block:: none
|
||||
|
||||
+----+--------------------------+---------------------+--------+
|
||||
| ID | Title | Updated At | Active |
|
||||
|
@ -269,9 +269,9 @@ You can easily negotiate content types with the request through the ``negotiate(
|
||||
|
||||
See the :doc:`Content Negotiation </libraries/content_negotiation>` page for more details.
|
||||
|
||||
***************
|
||||
|
||||
Class Reference
|
||||
***************
|
||||
---------------
|
||||
|
||||
.. note:: In addition to the methods listed here, this class inherits the methods from the
|
||||
:doc:`Request Class </libraries/request>` and the :doc:`Message Class </libraries/message>`.
|
||||
|
@ -210,14 +210,15 @@ If you want to verify that a session value exists, simply check with
|
||||
Or you can call ``has()``::
|
||||
|
||||
$session->has('some_name');
|
||||
|
||||
Pushing new value to session data
|
||||
=====================
|
||||
|
||||
The push method is used to push a new value onto a session value that is an array.
|
||||
Pushing new value to session data
|
||||
=================================
|
||||
|
||||
The push method is used to push a new value onto a session value that is an array.
|
||||
For instance, if the 'hobbies' key contains an array of hobbies, you can add a new value onto the array like so::
|
||||
|
||||
$session->push('hobbies', ['sport'=>'tennis']);
|
||||
|
||||
Removing Session Data
|
||||
=====================
|
||||
|
||||
|
@ -214,6 +214,7 @@ $time == tomorrow / yesterday Tomorrow / Yesterday
|
||||
$time > 59 minutes && < 1 day 1:37pm
|
||||
$time > now && < 1 hour in 35 minutes / 35 minutes ago
|
||||
$time == now Now
|
||||
=============================== =================================
|
||||
|
||||
The exact language used is controlled through the language file, Time.php.
|
||||
|
||||
@ -229,7 +230,7 @@ All of the following `getX` and `setX` methods can also be used as if they were
|
||||
like `getYear` can also be accessed through `$time->year`, and so on.
|
||||
|
||||
Getters
|
||||
=======
|
||||
-------
|
||||
|
||||
The following basic getters exist::
|
||||
|
||||
@ -415,7 +416,7 @@ a timezone string in as the second parameter. If no timezone is given, the syste
|
||||
$time1->equals('January 11, 2017 03:50:00', 'Europe/London'); // true
|
||||
|
||||
sameAs()
|
||||
------
|
||||
--------
|
||||
|
||||
This is identical to the **equals** method, except that it only returns true when the date, time, AND timezone are
|
||||
all identical::
|
||||
@ -522,5 +523,6 @@ $time > today && < 7 days in 4 days / 4 days ago
|
||||
$time > 1 hour && < 1 day in 8 hours / 8 hours ago
|
||||
$time > 1 minute && < 1 hour in 35 minutes / 35 minutes ago
|
||||
$time < 1 minute Now
|
||||
=============================== =================================
|
||||
|
||||
The exact language used is controlled through the language file, Time.php.
|
||||
|
Loading…
x
Reference in New Issue
Block a user