mirror of
https://github.com/codeigniter4/CodeIgniter4.git
synced 2025-02-20 11:44:28 +08:00
docs: do not show unneeded <?php
in sample code
This commit is contained in:
parent
df4e640850
commit
b93a90143e
@ -17,6 +17,7 @@ function where it is needed, or in your class constructor to make the
|
||||
database available globally in that class.
|
||||
|
||||
.. literalinclude:: connecting/001.php
|
||||
:lines: 2-
|
||||
|
||||
If the above function does **not** contain any information in the first
|
||||
parameter, it will connect to the default group specified in your database config
|
||||
@ -26,6 +27,7 @@ A convenience method exists that is purely a wrapper around the above line
|
||||
and is provided for your convenience:
|
||||
|
||||
.. literalinclude:: connecting/002.php
|
||||
:lines: 2-
|
||||
|
||||
Available Parameters
|
||||
--------------------
|
||||
@ -45,6 +47,7 @@ specify a particular database group from your config file. Examples:
|
||||
To choose a specific group from your config file you can do this:
|
||||
|
||||
.. literalinclude:: connecting/003.php
|
||||
:lines: 2-
|
||||
|
||||
Where ``group_name`` is the name of the connection group from your config
|
||||
file.
|
||||
@ -57,6 +60,7 @@ database connection every time. If you need to have a separate connection
|
||||
to the same database, send ``false`` as the second parameter:
|
||||
|
||||
.. literalinclude:: connecting/004.php
|
||||
:lines: 2-
|
||||
|
||||
Connecting to Multiple Databases
|
||||
================================
|
||||
@ -65,6 +69,7 @@ If you need to connect to more than one database simultaneously you can
|
||||
do so as follows:
|
||||
|
||||
.. literalinclude:: connecting/005.php
|
||||
:lines: 2-
|
||||
|
||||
Note: Change the words ``group_one`` and ``group_two`` to the specific
|
||||
group names you are connecting to.
|
||||
@ -82,6 +87,7 @@ a connection that uses your custom settings. The array passed in must be
|
||||
the same format as the groups are defined in the configuration file:
|
||||
|
||||
.. literalinclude:: connecting/006.php
|
||||
:lines: 2-
|
||||
|
||||
Reconnecting / Keeping the Connection Alive
|
||||
===========================================
|
||||
@ -96,6 +102,7 @@ or re-establish it.
|
||||
does not ping the server but it closes the connection then connects again.
|
||||
|
||||
.. literalinclude:: connecting/007.php
|
||||
:lines: 2-
|
||||
|
||||
Manually Closing the Connection
|
||||
===============================
|
||||
@ -104,3 +111,4 @@ While CodeIgniter intelligently takes care of closing your database
|
||||
connections, you can explicitly close the connection.
|
||||
|
||||
.. literalinclude:: connecting/008.php
|
||||
:lines: 2-
|
||||
|
Loading…
x
Reference in New Issue
Block a user