This article mainly introduces the config of CodeIgniter configuration. php Usage, detailed analysis of the configuration file config in CodeIgniter combined with the instance form. the parameter meanings and usage skills of php are described as follows. php usage. We will share this with you for your reference. The details are as follows:
Configuration instructions
$ Config ['language']: specifies the Project language pack. Note that the class library that comes with Codeigniter prompts that the language pack is in the/system/language/english/Directory. if you want to use these class libraries when configuring non-english, copy the language pack to the specified directory. Otherwise, a load error occurs.
$ Config ['charset']: sets the encoding used by the system. it is used in some functions that require encoding. the system and database are encoded in a unified manner.
$ Config ['enable _ Hooks']: Hook Switch Control. if it is set to true, hooks are allowed. otherwise, hooks are not allowed.
$ Config ['subclass _ prefix']: Set the prefix of the custom class library and function. the default value is MY _. for example, when you need to override the lang method in language helper, you only need to create my_javasage_herper.php in the helper directory and implement the lang function to implement "overload ". Here, MY _ is the value defined in subclass_prefix.
$ Config ['permitted _ uri_chars']: sets the characters allowed in the URL.
$ Config ['log _ threshold ']: Set the log record level. if it is 0, the log record is disabled. if it is 4, all information is recorded. generally, set it to 1. After setting, check whether the logs Directory has the write permission.
$ Config ['proxy _ IP']: when the server uses a proxy, REMOTER_ADDR obtains the IP address of the proxy server, it must be obtained from HTTP_X_FORWARDED_FOR, HTTP_CLIENT_IP, HTTP_X_CLIENT_IP, HTTP_X_CLUSTER_CLIENT_IP, or other preset values. The IP addresses of proxy servers are set here, which are separated by commas.
$ Config ['encryption _ key']: the encryption value. if you want to use the SESION that comes with CI, you must set this value. In CI's built-in SESSION storage and Cookie, encryption is performed for security reasons.
Read configuration
The config. php file is loaded through the get_config function during CI initialization, and config_item is also provided to obtain the config value, for example:
The code is as follows:
Echo config_item ('charset ');
CI also provides a configuration class to maintain the configuration file. You can also use the following method to obtain and set the config value. after the setting, the result of calling get_config will also change, so you can modify the config value before some logic.
// Obtain the charset value configured in config echo $ this-> config-> item ('charset '); // reset the charset value in config $ this-> config-> set_item ('charset', 'gbk ')