mirror of
https://github.com/codeigniter4/CodeIgniter4.git
synced 2025-02-20 11:44:28 +08:00
correcting literal code block on user guide
Signed-off-by: Mutasim Ridlo, S.Kom <ridho@mutasimridlo.com>
This commit is contained in:
parent
88f9db5340
commit
a30ea0a279
@ -53,7 +53,7 @@ have a trailing slash.
|
||||
By default, the application folder is namespace to the ``App`` namespace. While you are not forced to namespace the controllers,
|
||||
libraries, or models in the application directory, if you do, they will be found under the ``App`` namespace.
|
||||
You may change this namespace by editing the **/application/Config/Constants.php** file and setting the
|
||||
new namespace value under the ``APP_NAMESPACE`` setting.::
|
||||
new namespace value under the ``APP_NAMESPACE`` setting::
|
||||
|
||||
define('APP_NAMESPACE', 'App');
|
||||
|
||||
|
@ -117,7 +117,7 @@ There are occasions where you need to require that only a single instance of a s
|
||||
is created. This is easily handled with the ``getSharedInstance()`` method that is called from within the
|
||||
factory method. This handles checking if an instance has been created and saved
|
||||
within the class, and, if not, creates a new one. All of the factory methods provide a
|
||||
``$getShared = false`` value as the last parameter. You should stick to the method also.::
|
||||
``$getShared = false`` value as the last parameter. You should stick to the method also::
|
||||
|
||||
class Services
|
||||
{
|
||||
|
@ -87,7 +87,7 @@ while maintaining consistency of code appearance.
|
||||
Following the "best practice" above,
|
||||
the following code block would have a single tab at the beginning of
|
||||
each line containing braces, and two tabs at the beginning of the
|
||||
nested statements. No alignment is implied.::
|
||||
nested statements. No alignment is implied::
|
||||
|
||||
{
|
||||
$first = 1;
|
||||
|
@ -71,7 +71,7 @@ Synching
|
||||
Within your local repository, Git will have created an alias, **origin**, for the
|
||||
Github repository it is bound to. You want to create an alias for the shared
|
||||
repository, so that you can "synch" the two, making sure that your repository
|
||||
includes any other contributions that have been merged by us into the shared repo.::
|
||||
includes any other contributions that have been merged by us into the shared repo::
|
||||
|
||||
git remote add upstream UPSTREAM_URL
|
||||
|
||||
@ -102,7 +102,7 @@ change log, etc). This local branch should be named appropriately,
|
||||
for instance "fix/problem123" or "new/mind-reader".
|
||||
|
||||
For instance, make sure you are in the *develop* branch, and create a
|
||||
new feature branch, based on *develop*, for a new feature you are creating.::
|
||||
new feature branch, based on *develop*, for a new feature you are creating::
|
||||
|
||||
git checkout develop
|
||||
git checkout -b new/mind-reader
|
||||
|
@ -126,7 +126,7 @@ Usage Example
|
||||
*************
|
||||
|
||||
In this example some simple code is placed in **application/controllers/Migrate.php**
|
||||
to update the schema.::
|
||||
to update the schema::
|
||||
|
||||
<?php
|
||||
|
||||
@ -167,7 +167,7 @@ Migrates all database groups to the latest available migrations::
|
||||
**current**
|
||||
|
||||
Migrates all database groups to match the version set in ``$currentVersion``. This will migrate both
|
||||
up and down as needed to match the specified version.::
|
||||
up and down as needed to match the specified version::
|
||||
|
||||
> php index.php migrations current
|
||||
|
||||
@ -194,13 +194,13 @@ Rolls back all migrations, taking all database groups to a blank slate, effectiv
|
||||
|
||||
**refresh**
|
||||
|
||||
Refreshes the database state by first rolling back all migrations, and then migrating to the latest version.::
|
||||
Refreshes the database state by first rolling back all migrations, and then migrating to the latest version::
|
||||
|
||||
> php index.php migrations refresh
|
||||
|
||||
**status**
|
||||
|
||||
Displays a list of all migrations and the date and time they were ran, or '--' if they have not be ran.::
|
||||
Displays a list of all migrations and the date and time they were ran, or '--' if they have not be ran::
|
||||
|
||||
> php index.php migrations status
|
||||
Filename Migrated On
|
||||
@ -271,7 +271,7 @@ Class Reference
|
||||
:returns: The current MigrationRunner instance
|
||||
:rtype: CodeIgniter\Database\MigrationRunner
|
||||
|
||||
Sets the path the library should look for migration files.::
|
||||
Sets the path the library should look for migration files::
|
||||
|
||||
$migration->setPath($path)
|
||||
->latest();
|
||||
|
@ -76,7 +76,7 @@ Configuring Your Model
|
||||
|
||||
The model class has a few configuration options that can be set to allow the class' methods
|
||||
to work seamlessly for you. The first two are used by all of the CRUD methods to determine
|
||||
what table to use and how we can find the required records.::
|
||||
what table to use and how we can find the required records::
|
||||
|
||||
class UserModel extends \CodeIgniter\Model
|
||||
{
|
||||
@ -159,7 +159,7 @@ Returns a single row where the primary key matches the value passed in as the fi
|
||||
The value is returned in the format specified in $returnType.
|
||||
|
||||
You can specify more than one row to return by passing an array of primaryKey values instead
|
||||
of just one.::
|
||||
of just one::
|
||||
|
||||
$users = $userModel->find([1,2,3]);
|
||||
|
||||
@ -183,7 +183,7 @@ Returns all results.
|
||||
|
||||
$users = $userModel->findAll();
|
||||
|
||||
This query may be modified by interjecting Query Builder commands as needed prior to calling this method.::
|
||||
This query may be modified by interjecting Query Builder commands as needed prior to calling this method::
|
||||
|
||||
$users = $userModel->where('active', 1)
|
||||
->findAll();
|
||||
@ -218,7 +218,7 @@ temporarily override this, you can use the withDeleted() method prior to calling
|
||||
**onlyDeleted()**
|
||||
|
||||
Whereas withDeleted() will return both deleted and not-deleted rows, this method modifies
|
||||
the next find* methods to return only soft deleted rows.::
|
||||
the next find* methods to return only soft deleted rows::
|
||||
|
||||
$deletedUsers = $userModel->onlyDeleted()
|
||||
->findAll();
|
||||
|
@ -915,7 +915,7 @@ function, or empty_table().
|
||||
**$builder->emptyTable()**
|
||||
|
||||
Generates a delete SQL string and runs the
|
||||
query.::
|
||||
query::
|
||||
|
||||
$builder->emptyTable('mytable'); // Produces: DELETE FROM mytable
|
||||
|
||||
|
@ -87,7 +87,7 @@ CLI-Only Routing
|
||||
In your **Routes.php** file you can create routes that are only accessible from
|
||||
the CLI as easily as you would create any other route. Instead of using the ``get()``,
|
||||
``post()``, or similar method, you would use the ``cli()`` method. Everything else
|
||||
works exactly like a normal route definition.::
|
||||
works exactly like a normal route definition::
|
||||
|
||||
$routes->cli('tools/message/(:segment)', 'Tools::message/$1');
|
||||
|
||||
|
@ -101,7 +101,7 @@ There will be times when you will have several variables of the same name. When
|
||||
system has no way of knowing what the correct value should be. You can protect against this by
|
||||
"namespacing" the variables. This is done by including the name of the config file (all lower case),
|
||||
followed by a period (.), and then the variable name itself. This is especially common when you
|
||||
have multiple database connections.::
|
||||
have multiple database connections::
|
||||
|
||||
// Not namespaced
|
||||
db_name = "my_db"
|
||||
|
@ -97,7 +97,7 @@ If you need to use a constructor in your class make sure you extend the parent c
|
||||
instead of the native ones (this is known as “method overriding”). This allows you to substantially alter the CodeIgniter core.
|
||||
|
||||
If you are extending the Controller core class, then be sure to extend your new class in your application controller’s
|
||||
constructors.::
|
||||
constructors::
|
||||
|
||||
class Home extends App\BaseController {
|
||||
|
||||
|
@ -189,7 +189,7 @@ To add data to the Vars tab you must:
|
||||
2. Implement ``getVarData()`` method.
|
||||
|
||||
The ``getVarData()`` method should return an array containing arrays of key/value pairs to display. The name of the
|
||||
outer array's key is the name of the section on the Vars tab.::
|
||||
outer array's key is the name of the section on the Vars tab::
|
||||
|
||||
$data = [
|
||||
'section 1' => [
|
||||
|
@ -71,7 +71,7 @@ PageNotFoundException
|
||||
This is used to signal a 404, Page Not Found error. When thrown, the system will show the view found at
|
||||
``/application/views/errors/html/error_404.php``. You should customize all of the error views for your site.
|
||||
If, in ``Config/Routes.php``, you have specified a 404 Override, that will be called instead of the standard
|
||||
404 page.::
|
||||
404 page::
|
||||
|
||||
if (! $page = $pageModel->find($id))
|
||||
{
|
||||
@ -84,7 +84,7 @@ ConfigException
|
||||
---------------
|
||||
|
||||
This exception should be used when the values from the configuration class are invalid, or when the config class
|
||||
is not the right type, etc.::
|
||||
is not the right type, etc::
|
||||
|
||||
throw new \CodeIgniter\ConfigException();
|
||||
|
||||
@ -93,7 +93,7 @@ This provides an HTTP status code of 500, and an exit code of 3.
|
||||
UnknownFileException
|
||||
--------------------
|
||||
|
||||
Use this exception when a file cannot be found.::
|
||||
Use this exception when a file cannot be found::
|
||||
|
||||
throw new \CodeIgniter\UnknownFileException();
|
||||
|
||||
@ -102,7 +102,7 @@ This provides an HTTP status code of 500, and an exit code of 4.
|
||||
UnknownClassException
|
||||
---------------------
|
||||
|
||||
Use this exception when a class cannot be found.::
|
||||
Use this exception when a class cannot be found::
|
||||
|
||||
throw new \CodeIgniter\UnknownClassException($className);
|
||||
|
||||
@ -120,7 +120,7 @@ This provides an HTTP status code of 500, and an exit code of 6.
|
||||
UserInputException
|
||||
------------------
|
||||
|
||||
Use this exception when the user's input is not valid.::
|
||||
Use this exception when the user's input is not valid::
|
||||
|
||||
throw new \CodeIgniter\UserInputException();
|
||||
|
||||
|
@ -22,7 +22,7 @@ Defining a Hook
|
||||
|
||||
Most hooks are defined within the **application/Config/Hooks.php** file. You can subscribe an action to a hook with
|
||||
the Hooks class' ``on()`` method. The first parameter is the name of the hook to subscribe to. The second parameter is
|
||||
a callable that will be run when that event is triggered.::
|
||||
a callable that will be run when that event is triggered::
|
||||
|
||||
use CodeIgniter\Hooks\Hooks;
|
||||
|
||||
@ -53,14 +53,14 @@ Setting Priorities
|
||||
|
||||
Since multiple methods can be subscribed to a single event, you will need a way to define in what order those methods
|
||||
are called. You can do this by passing a priority value as the third parameter of the ``on()`` method. Lower values
|
||||
are executed first, with a value of 1 having the highest priority, and there being no limit on the lower values.::
|
||||
are executed first, with a value of 1 having the highest priority, and there being no limit on the lower values::
|
||||
|
||||
Hooks::on('post_controller_constructor', 'some_function', 25);
|
||||
|
||||
Any subscribers with the same priority will be executed in the order they were defined.
|
||||
|
||||
Three constants are defined for your use, that set some helpful ranges on the values. You are not required to use these
|
||||
but you might find they aid readability.::
|
||||
but you might find they aid readability::
|
||||
|
||||
define('HOOKS_PRIORITY_LOW', 200);
|
||||
define('HOOKS_PRIORITY_NORMAL', 100);
|
||||
@ -78,7 +78,7 @@ need to call the ``trigger()`` method on the **Hooks** class with the name of th
|
||||
\CodeIgniter\Hooks\Hooks::trigger('some_hook');
|
||||
|
||||
You can pass any number of arguments to the subscribers by adding them as additional parameters. Subscribers will be
|
||||
given the arguments in the same order as defined.::
|
||||
given the arguments in the same order as defined::
|
||||
|
||||
\CodeIgniter\Hooks\Hooks::trigger('some_hook', $foo, $bar, $baz);
|
||||
|
||||
|
@ -37,7 +37,7 @@ are requested to be logged by the application, but the threshold doesn't allow t
|
||||
ignored. The simplest method to use is to set this value to the minimum level that you want to have logged. For example,
|
||||
if you want to log debug messages, and not information messages, you would set the threshold to ``5``. Any log requests with
|
||||
a level of 5 or less (which includes runtime errors, system errors, etc) would be logged and info, notices, and warnings
|
||||
would be ignored.::
|
||||
would be ignored::
|
||||
|
||||
public $threshold = 5;
|
||||
|
||||
|
@ -61,7 +61,7 @@ third parameter. This will use the currently configured cache engine.
|
||||
<?= view_cell('\App\Libraries\Blog::recentPosts', 'limit=5', 300) ?>
|
||||
|
||||
You can provide a custom name to use instead of the auto-generated one if you like, by passing the new name
|
||||
as the fourth parameter.::
|
||||
as the fourth parameter::
|
||||
|
||||
// Cache the view for 5 minutes
|
||||
<?= view_cell('\App\Libraries\Blog::recentPosts', 'limit=5', 300, 'newcacheid') ?>
|
||||
|
@ -119,7 +119,7 @@ exactly as you would the ``write()`` method::
|
||||
|
||||
This command will take a string, start printing it on the current line, and wrap it to a set length on new lines.
|
||||
This might be useful when displaying a list of options with descriptions that you want to wrap in the current
|
||||
window and not go off screen.::
|
||||
window and not go off screen::
|
||||
|
||||
CLI::color("task1\t", 'yellow');
|
||||
CLI::wrap("Some long description goes here that might be longer than the current window.");
|
||||
@ -172,7 +172,7 @@ The ``newLine()`` method displays a blank line to the user. It does not take any
|
||||
|
||||
You can clear the current terminal window with the ``clearScreen()`` method. In most versions of Windows, this will
|
||||
simply insert 40 blank lines since Windows doesn't support this feature. Windows 10 bash integration should change
|
||||
this.::
|
||||
this::
|
||||
|
||||
CLI::clearScreen();
|
||||
|
||||
|
@ -75,7 +75,7 @@ available to you::
|
||||
$language = $response->negotiateLanguage(['en', 'fr']);
|
||||
|
||||
While the ``request()`` method is the most flexible, you can also use the following shortcut methods. They
|
||||
each take the URL as the first parameter and an array of options as the second.::
|
||||
each take the URL as the first parameter and an array of options as the second::
|
||||
|
||||
* $client->get('http://example.com');
|
||||
* $client->delete('http://example.com');
|
||||
@ -90,7 +90,7 @@ Base URI
|
||||
|
||||
A ``base_uri`` can be set as one of the options during the instantiation of the class. This allows you to
|
||||
set a base URI, and then make all requests with that client using relative URLs. This is especially handy
|
||||
when working with APIs.::
|
||||
when working with APIs::
|
||||
|
||||
$client = Services::curlrequest([
|
||||
'base_uri' => 'https://example.com/api/v1/'
|
||||
@ -194,7 +194,7 @@ Allows you to provide Authentication details for `HTTP Basic <http://www.ietf.or
|
||||
`Digest <http://www.ietf.org/rfc/rfc2069.txt>`_ and authentication. Your script may have to do extra to support
|
||||
Digest authentication - this simply passes the username and password along for you. The value must be an
|
||||
array where the first element is the username, and the second is the password. The third parameter should be
|
||||
the type of authentication to use, either ``basic`` or ``digest``.::
|
||||
the type of authentication to use, either ``basic`` or ``digest``::
|
||||
|
||||
$client->request('GET', 'http://example.com', ['auth' => ['username', 'password', 'digest']]);
|
||||
|
||||
@ -208,7 +208,7 @@ The first way is to use the ``setBody()`` method::
|
||||
->request('put', 'http://example.com');
|
||||
|
||||
The second method is by passing a ``body`` option in. This is provided to maintain Guzzle API compatibility,
|
||||
and functions the exact same way as the previous example. The value must be a string.::
|
||||
and functions the exact same way as the previous example. The value must be a string::
|
||||
|
||||
$client->request('put', 'http://example.com', ['body' => $body]);
|
||||
|
||||
@ -247,7 +247,7 @@ You can pass a filename as the value for debug to have the output written to a f
|
||||
delay
|
||||
=====
|
||||
|
||||
Allows you to pause a number of milliseconds before sending the request.::
|
||||
Allows you to pause a number of milliseconds before sending the request::
|
||||
|
||||
// Delay for 2 seconds
|
||||
$response->request('GET', 'http://example.com', ['delay' => 2000]);
|
||||
@ -257,7 +257,7 @@ form_params
|
||||
|
||||
You can send form data in an application/x-www-form-urlencoded POST request by passing an associative array in
|
||||
the ``form_params`` option. This will set the ``Content-Type`` header to ``application/x-www-form-urlencoded``
|
||||
if it's not already set.::
|
||||
if it's not already set::
|
||||
|
||||
$client->request('POST', '/post', [
|
||||
'form_params' => [
|
||||
@ -275,7 +275,7 @@ headers
|
||||
|
||||
While you can set any headers this request needs by using the ``setHeader()`` method, you can also pass an associative
|
||||
array of headers in as an option. Each key is the name of a header, and each value is a string or array of strings
|
||||
representing the header field values.::
|
||||
representing the header field values::
|
||||
|
||||
$client->request('get', '/', [
|
||||
'headers' => [
|
||||
@ -292,7 +292,7 @@ http_errors
|
||||
===========
|
||||
|
||||
By default, CURLRequest will fail if the HTTP code returned is greater than or equal to 400. You can set
|
||||
``http_errors`` to ``false`` to return the content instead.::
|
||||
``http_errors`` to ``false`` to return the content instead::
|
||||
|
||||
$client->request('GET', '/status/500');
|
||||
// Will fail verbosely
|
||||
@ -306,7 +306,7 @@ json
|
||||
|
||||
The ``json`` option is used to easily upload JSON encoded data as the body of a request. A Content-Type header
|
||||
of ``application/json`` is added, overwriting any Content-Type that might be already set. The data provided to
|
||||
this option can be any value that ``json_encode()`` accepts.::
|
||||
this option can be any value that ``json_encode()`` accepts::
|
||||
|
||||
$response = $client->request('PUT, '/put', ['json' => ['foo' => 'bar']]);
|
||||
|
||||
@ -320,7 +320,7 @@ multipart
|
||||
When you need to send files and other data via a POST request, you can use the ``multipart`` option, along with
|
||||
the `CURLFile Class <http://php.net/manual/en/class.curlfile.php>`_. The values should be an associative array
|
||||
of POST data to send. For safer usage, the legacy method of uploading files by prefixing their name with an `@`
|
||||
has been disabled. Any files that you want to send must be passed as instances of CURLFile.::
|
||||
has been disabled. Any files that you want to send must be passed as instances of CURLFile::
|
||||
|
||||
$post_data = [
|
||||
'foo' => 'bar',
|
||||
@ -334,7 +334,7 @@ has been disabled. Any files that you want to send must be passed as instances o
|
||||
query
|
||||
=====
|
||||
|
||||
You can pass along data to send as query string variables by passing an associative array as the ``query`` option.::
|
||||
You can pass along data to send as query string variables by passing an associative array as the ``query`` option::
|
||||
|
||||
// Send a GET request to /get?foo=bar
|
||||
$client->request('GET', '/get', ['query' => ['foo' => 'bar']]);
|
||||
@ -355,7 +355,7 @@ This option describes the SSL certificate verification behavior. If the ``verify
|
||||
SSL certificate verification and uses the default CA bundle provided by the operating system. If set to ``false`` it
|
||||
will disable the certificate verification (this is insecure, and allows man-in-the-middle attacks!). You can set it
|
||||
to a string that contains the path to a CA bundle to enable verification with a custom certificate. The default value
|
||||
is true.::
|
||||
is true::
|
||||
|
||||
// Use the system's CA bundle (this is the default setting)
|
||||
$client->request('GET', '/', ['verify' => true]);
|
||||
@ -370,7 +370,7 @@ version
|
||||
=======
|
||||
|
||||
To set the HTTP protocol to use, you can pass a string or float with the version number (typically either 1.0
|
||||
or 1.1, 2.0 is currently unsupported.)
|
||||
or 1.1, 2.0 is currently unsupported.)::
|
||||
|
||||
// Force HTTP/1.0
|
||||
$client->request('GET', '/', ['version' => 1.0]);
|
||||
|
@ -325,16 +325,16 @@ The methods provided by the parent classes that are available are:
|
||||
|
||||
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.::
|
||||
you want to use::
|
||||
|
||||
$request->getVar(null, FILTER_SANITIZE_STRING); // returns all POST items with string sanitation
|
||||
|
||||
To return an array of multiple POST parameters, pass all the required keys as an array.::
|
||||
To return an array of multiple POST parameters, pass all the required keys as an array::
|
||||
|
||||
$request->getVar(['field1', 'field2']);
|
||||
|
||||
Same rule applied here, to retrieve the parameters with filtering, set the second parameter to
|
||||
the filter type to apply.::
|
||||
the filter type to apply::
|
||||
|
||||
$request->getVar(['field1', 'field2'], FILTER_SANITIZE_STRING);
|
||||
|
||||
@ -394,7 +394,7 @@ The methods provided by the parent classes that are available are:
|
||||
$request->getCookie('some_cookie');
|
||||
$request->getCookie('some_cookie, FILTER_SANITIZE_STRING); // with filter
|
||||
|
||||
To return an array of multiple cookie values, pass all the required keys as an array.::
|
||||
To return an array of multiple cookie values, pass all the required keys as an array::
|
||||
|
||||
$request->getCookie(array('some_cookie', 'some_cookie2'));
|
||||
|
||||
@ -426,7 +426,7 @@ The methods provided by the parent classes that are available are:
|
||||
:returns: The User Agent string, as found in the SERVER data, or null if not found.
|
||||
:rtype: mixed
|
||||
|
||||
This method returns the User Agent string from the SERVER data.::
|
||||
This method returns the User Agent string from the SERVER data::
|
||||
|
||||
$request->getUserAgent();
|
||||
|
||||
|
@ -41,7 +41,7 @@ Class Reference
|
||||
:returns: The current message body
|
||||
:rtype: string
|
||||
|
||||
Returns the current message body, if any has been set. If not body exists, returns null.::
|
||||
Returns the current message body, if any has been set. If not body exists, returns null::
|
||||
|
||||
echo $message->body();
|
||||
|
||||
@ -81,7 +81,7 @@ Class Reference
|
||||
:rtype: string|array|null
|
||||
|
||||
Allows you to retrieve the current value of a single message header. ``$name`` is the case-insensitive header name.
|
||||
While the header is converted internally as described above, you can access the header with any type of case.::
|
||||
While the header is converted internally as described above, you can access the header with any type of case::
|
||||
|
||||
// These are all the same:
|
||||
$message->header('HOST');
|
||||
@ -89,7 +89,7 @@ Class Reference
|
||||
$message->header('host');
|
||||
|
||||
If the header has multiple values, the values will return as an array of values. You can use the ``headerLine()``
|
||||
method to retrieve the values as a string.::
|
||||
method to retrieve the values as a string::
|
||||
|
||||
echo $message->header('Accept-Language');
|
||||
|
||||
@ -126,7 +126,7 @@ Class Reference
|
||||
|
||||
Sets the value of a single header. ``$name`` is the case-insensitive name of the header. If the header
|
||||
doesn't already exist in the collection, it will be created. The ``$value`` can be either a string
|
||||
or an array of strings.::
|
||||
or an array of strings::
|
||||
|
||||
$message->setHeader('Host', 'codeigniter.com');
|
||||
|
||||
@ -167,7 +167,7 @@ Class Reference
|
||||
:returns: The current message instance
|
||||
:rtype: CodeIgniter\\HTTP\\Message
|
||||
|
||||
Sets the HTTP protocol version this Message uses. Valid values are ``1.0`` or ``1.1``.::
|
||||
Sets the HTTP protocol version this Message uses. Valid values are ``1.0`` or ``1.1``::
|
||||
|
||||
$message->setProtocolVersion('1.1');
|
||||
|
||||
@ -228,7 +228,7 @@ Class Reference
|
||||
:rtype: string
|
||||
|
||||
Determines the best match between the application-supported values and the ``Accept-Encoding`` header value.
|
||||
If no match is found, will return the first element of the ``$supported`` array.::
|
||||
If no match is found, will return the first element of the ``$supported`` array::
|
||||
|
||||
$supported = [
|
||||
'gzip',
|
||||
|
@ -202,7 +202,7 @@ The methods provided by the parent class that are available are:
|
||||
:rtype: int
|
||||
|
||||
Returns the currently status code for this response. If no status code has been set, a BadMethodCallException
|
||||
will be thrown.::
|
||||
will be thrown::
|
||||
|
||||
echo $response->statusCode();
|
||||
|
||||
@ -237,7 +237,7 @@ The methods provided by the parent class that are available are:
|
||||
:returns: The current response instance.
|
||||
:rtype: CodeIgniter\HTTP\Response
|
||||
|
||||
Sets the date used for this response. The ``$date`` argument must be an instance of ``DateTime``.::
|
||||
Sets the date used for this response. The ``$date`` argument must be an instance of ``DateTime``::
|
||||
|
||||
$date = DateTime::createFromFormat('j-M-Y', '15-Feb-2016');
|
||||
$response->setDate($date);
|
||||
@ -249,7 +249,7 @@ The methods provided by the parent class that are available are:
|
||||
:returns: The current response instance.
|
||||
:rtype: CodeIgniter\HTTP\Response
|
||||
|
||||
Sets the content type this response represents.::
|
||||
Sets the content type this response represents::
|
||||
|
||||
$response->setContentType('text/plain');
|
||||
$response->setContentType('text/html');
|
||||
@ -266,7 +266,7 @@ The methods provided by the parent class that are available are:
|
||||
:rtype: CodeIgniter\HTTP\Response
|
||||
|
||||
Sets the ``Cache-Control`` header to turn off all HTTP caching. This is the default setting
|
||||
of all response messages.::
|
||||
of all response messages::
|
||||
|
||||
$response->noCache();
|
||||
|
||||
|
@ -398,7 +398,7 @@ same way::
|
||||
|
||||
You may also use the ``stop()`` method to completely kill the session
|
||||
by removing the old session_id, destroying all data, and destroying
|
||||
the cookie that contained the session id.::
|
||||
the cookie that contained the session id::
|
||||
|
||||
$session->stop();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user