CodeIgniter configuration autoload.php Automatic load usage analysis, codeigniterautoload
In this paper, the autoload.php automatic loading usage of codeigniter configuration is analyzed. Share to everyone for your reference, as follows:
CodeIgniter with the ability to load automatically, can load the class library, model, configuration, language pack and so on, it is very convenient for the function that need to be used globally.
For example, there is a global function written in app_helper.php that requires a global load of this function, just set autoload.php:
Copy the code as follows: $autoload [' helper '] = Array (' app ');
Next, all the places can be used, configuration, model and other configurations similar. But at the same time, it is convenient to consider the disadvantages of this kind of loading mode.
If a project is divided into two pieces, such as the front desk, backstage, then this feature is required before and after the platform? If there are different business modules between the front and back stations, is it necessary to use each module?
If you need to, it is good to write here, if not required, it is not recommended to write here.
For related class libraries, function calls should be loaded on demand
Loading can be implemented in a number of ways, the specified page load, can be in the common controller, function load, once the load can be used globally. A common practice for individuals is to ignore the file, load the global function manually, and so on.
Speaking of which, by the way CI loading mechanism. Here's how to load a class library, function, and so on:
$this->load->library (' Session '), $this->load->model (' Hello_model '); $this->load->helper (Array ( ' URL ', ' array '); $this->load->language (Array (' User_menu ', ' user_tips '));
The load mode is uniform and easy to use, but the Load class library Shishun is a bit inconvenient. Once again the Load class library will not be loaded again, but from the saved static array, you need to pay attention to the state of the member property, to prevent because the value still exists and cause the program exception.
More interested in CodeIgniter related content readers can view this site topic: "CodeIgniter Introductory Tutorial" and "CI (codeigniter) Framework Advanced 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
- Example analysis of config.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
http://www.bkjia.com/PHPjc/1094758.html www.bkjia.com true http://www.bkjia.com/PHPjc/1094758.html techarticle autoload.php Automatic load usage analysis of CodeIgniter configuration, codeigniterautoload This paper analyzes the autoload.php automatic loading usage of codeigniter configuration. Share to everyone for your reference ...