$this->load->library () Usage analysis in CI framework, this-load-_php tutorial

Source: Internet
Author: User
Tags autoload custom name zend framework

$this->load->library () Usage analysis in CI framework, this-load-


This paper analyzes the use of $this->load->library () in CI framework. Share to everyone for your reference, as follows:

The first time I failed to load, the original file name and the class name are different reasons, first summarize about CI loading your own class file considerations:

1. Third-party loading should be placed under the Application/libraries file

2. The file name and class name should be the same, and the first letter capitalized, such as the file name excel.php class name should be Excel

3. By:$this->load->library (' class '); The way to load it where you need it

4. Can also be loaded in the application/config/autoload.php, add in the file

$autoload [' libraries '] = Array (' Excel ');

5. When loading, if libraries has multiple folders, such as myfile can be loaded in the following way:

$this->load->library (' myfile/class ');

6. The second parameter can be placed as a parameter, as follows:

$config = Array (' mailtype ' = ' html ', ' charset ' = ' utf-8 ', ' priority ' = ' 1 ');
$this->load->library (' email ', $config);

7. The third parameter can use your custom name in the following way:

$this->load->library (' Session ', ' ', ' my_session ');//The session class can now be accessed in the following way: $this->my_session->set_ UserData ("Session name", "Session value");

More interested in CodeIgniter related content readers can view this site topic: "CodeIgniter Introductory Tutorial", "CI (codeigniter) Framework Advanced Tutorial", "PHP Excellent Development Framework Summary", "thinkphp Getting Started", " Summary of common methods of thinkphp, "Introduction to Zend Framework Frame", "Introduction to PHP Object-oriented Programming", "Introduction to Php+mysql Database Operation" and "PHP common database Operation Skills Summary"

It is hoped that this article is helpful to the PHP program design based on CodeIgniter framework.

http://www.bkjia.com/PHPjc/1127850.html www.bkjia.com true http://www.bkjia.com/PHPjc/1127850.html techarticle $this-load-library () usage analysis in CI framework, this-load-This paper analyzes the usage of $this-load-library () in CI framework. Share to everyone for your reference, as follows: I first load ...

  • 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.