1. library folder
If you want to extend the CI function, place your class library here. Note that this folder is composed of classes. You can see the notes for loading the library!
2. helper folder
If you need to use some functions to complete some small functions, put them here. Here we use procedural code rather than classes. Generally, helper is used for view,
The usage is as follows:
Copy codeThe Code is as follows:
$ This-> load-> helper ('filename ')
Filename is the name of the file corresponding to the helper function, excluding the _ helper. php extension. The file name should be saved as: filename_helper.php, put in the helper folder!
3. hooks folder
Store the hooks you have created. Hooks are the control methods used to load other files and cannot be called by controllers. They are automatically called by the system. When CodeIgniter
After running, it generates a special process.
Of course, you can customize some actions to replace some stages of the program running. For example, you can trigger your script before or after the controller is loaded, or at other times.
Seven CI mount points:
Pre_system
Early calls of system execution. No route or other processes are executed only when the benchmark and hooks classes are loaded.
Pre_controller
Call before calling any of your controllers. The basic class, route selection, and security check used at this time have been completed.
Post_controller_constructor
After your controller is instantiated, it is called before any method is called.
Post_controller
It is called after your controller is fully running.
Display_override
Overwrite the _ display () function to send the final page to the web browser at the end of the system execution. this allows you to display data in your own way. note that you need to reference the CI super object through $ this-> CI = & get_instance, then, the final data can be obtained by calling $ this-> CI-> output-> get_output.
Cache_override
You can call your own function to replace the _ display_cache () function in the output class. This allows you to use your own cache display method.
Post_system
After the final coloring page is sent to the browser, the browser receives the final data and calls
The following describes how to use hooks: