config.php Usage Example Analysis of codeigniter configuration, Codeigniterconfig
In this paper, the config.php usage of codeigniter configuration is analyzed. Share to everyone for your reference, as follows:
Configuration Instructions
$config [' Language ']: Specifies the project language pack. Note that when CodeIgniter comes with the class library error prompt language pack is located in the/system/language/english/directory, when the configuration of non-Chinese, if you need to use these class libraries, you need to copy the language package to the specified directory, Otherwise, load error will occur.
$config [' CharSet ']: Set the encoding used by the system, in some need to specify the encoding function will be used, the system, the database unified code.
$config [' Enable_hooks ']: Hook switch control, set to TRUE indicates that hooks are allowed, otherwise it is not allowed.
$config [' Subclass_prefix ']: Set a custom class library, a function prefix, default to My_, such as the need to rewrite the Lang method in language helper, only to create My_ in the helper directory language_herper.php, and implement the Lang function to implement "overloading." The my_ here is the value defined in the Subclass_prefix.
$config [' Permitted_uri_chars ']: Sets the allowed characters in the URL.
$config [' Log_threshold ']: Set the logging level to 0 to turn off logging, and 4 to log all information, normally set to 1. After setting, you need to confirm that the next logs directory has write permissions.
$config [' proxy_ips ']: When the server uses the proxy, REMOTER_ADDR obtains the proxy server IP, need from Http_x_forwarded_for, HTTP_CLIENT_IP, Http_x_client_ip, HTTP_X_CLUSTER_CLIENT_IP, or other set values. This is the proxy server IP, separated by commas.
$config [' Encryption_key ']: Encrypted value, you must set this value if you want to use the sesion that comes with CI. CI's self-contained session store and cookie are encrypted for security purposes.
Configure read
The config.php file is loaded by the Get_config function during the start of CI initialization, and Config_item is provided to obtain the value of config, such as:
Copy the Code code as follows: Echo Config_item (' CharSet ');
CI also provides a configuration class to maintain the configuration file. You can also get and set the value of config in the following way, and the result of calling Get_config after the setting is changed, so you can modify the value of config before some logic.
Get the charset value configured in config echo $this->config->item (' charset ');//Reset the CharSet value in config $this->config->set_ Item (' CharSet ', ' GBK ')
For more information on CodeIgniter framework related content readers can view this site topic: "CodeIgniter Introductory Tutorial"
It is hoped that this article is helpful to the PHP program design based on CodeIgniter framework.
Articles you may be interested in:
- Example analysis of database.php usage of codeigniter configuration
- Example analysis of session usage of CodeIgniter configuration
- Example analysis of routes.php usage of codeigniter configuration
- Setting enhanced configuration class instance for CI (CodeIgniter)
- Using Smarty3 basic configuration in CodeIgniter
- CodeIgniter Framework method under Nginx configuration
- CI (codeigniter) Framework Configuration
- CodeIgniter Basic Configuration Detailed Introduction
- Parsing the CodeIgniter custom configuration file
- autoload.php Automatic load usage analysis of CodeIgniter configuration
http://www.bkjia.com/PHPjc/1093701.html www.bkjia.com true http://www.bkjia.com/PHPjc/1093701.html techarticle config.php Usage Example Analysis of CodeIgniter configuration, Codeigniterconfig This paper analyzes the config.php usage of codeigniter configuration. Share to everyone for your reference, as follows: Configuration ...