Libraries,helpers,hooks folder details _php instance in CI framework

Source: Internet
Author: User

1.library folder

If you want to extend the function of CI, then put your class library here, note that this folder is composed of class, you can see if loading the library notice!

2.helper folder

If you need to use a few functions to help you do some minor functions, then put it on, it's all procedural code instead of class, and the general Helper is for view,
Use the following methods:

Copy Code code as follows:

$this->load->helper (' filename ')

FileName is the file name of the auxiliary function, excluding the _helper.php extension. The filename should be saved as: filename_helper.php, put it under the helper folder!

3.hooks folder

Store the hooks you created. Hooks are used to load other files of the control method, can not be called by the controller, the system is automatically invoked. When CodeIgniter
After running, it will produce a special process.
Of course, you can customize some of the actions to override certain stages of the program's operation. For example, you can run a specific script before the controller has just loaded or just load, or at other times to trigger your script.

Seven mount points for CI:

Pre_system

An earlier call that was performed by the system. Only when the benchmark and hooks classes have finished loading. No routing or other process is performed.

Pre_controller

Call before calling any of your controllers. The base class used at this time, routing and security checks are complete.

Post_controller_constructor

Called before any method calls after your controller is instantiated.

Post_controller

Called after your controller is fully operational.

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 it in your own way. Note that you need to refer to CI Super objects through $this->ci =& get_instance (), Such final data can then be obtained by calling $this->ci->output->get_output ().

Cache_override

Lets you call your own function to replace the _display_cache () function in the output class. This allows you to use your own caching display method

Post_system

After the final coloring page is sent to the browser, the browser receives the final data at the end of the system execution call
About the use of hooks, the manual has a detailed use of instructions, screenshots are as follows:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.