1. if you want to extend the CI function in the library folder, place your class library here. Note that this folder is composed of classes. you can check the notes for loading the library! 2. helper folder if you need to use
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:
$ This-> load-> helper ('Filename')
FilenameIs the name of the file corresponding to the auxiliary function, not including_ Helper. phpExtension. 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. After CodeIgniter runs, 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_ Display ()Function to send the final page to the web browser at the end of the system execution. This allows you to display the page in your own way.$ This-> CI = & get_instance ()Reference the CI super object, and then such final data can be called$ This-> CI-> output-> get_output ().
- Cache_override
You can call your own functions to replace_ Display_cache ()Function. 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: