Home > Backend Development > PHP Tutorial > Usage analysis of $this->load->library() in CI framework, this-load-_PHP tutorial

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-12 08:52:12
Original
1232 people have browsed it

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

This article analyzes $this->load- in CI framework >Usage of library(). Share it with everyone for your reference, the details are as follows:

My first loading failed. It turned out to be because the file name and class name were different. Let me first summarize the precautions for loading your own class files in CI:

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

2. The file name and class name should be the same, and the first letter should be capitalized. For example, the file name Excel.php and the class name should be Excel

3. Load where you need by: $this->load->library('class');

4. You can also load it in application/config/autoload.php and add

to the file.
$autoload['libraries'] = array('Excel');

Copy after login

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

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

Copy after login

6. The second parameter can be placed as follows:

$config = array (
 'mailtype' => 'html',
 'charset' => 'utf-8,
 'priority' => '1'
);

Copy after login
$this->load->library('email', $config);

Copy after login

7. The third parameter can use your customized name as follows:

$this->load->library('session', '', 'my_session');
// Session 类现在可以通过下面的方式访问:
$this->my_session ->set_userdata("session名","session值");

Copy after login

Readers who are interested in more CodeIgniter related content can check out the special topics of this site: "codeigniter introductory tutorial", "CI (CodeIgniter) framework advanced tutorial", "php excellent development framework summary", "ThinkPHP introductory tutorial", "Summary of Common Methods in ThinkPHP", "Introduction Tutorial on Zend FrameWork Framework", "Introduction Tutorial on PHP Object-Oriented Programming", "Introduction Tutorial on PHP MySQL Database Operation" and "Summary of Common PHP Database Operation Skills"

I hope this article will be helpful to everyone’s PHP program design based on the CodeIgniter framework.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1127850.htmlTechArticleAnalysis of the usage of $this-load-library() in the CI framework, this-load- This article analyzes the usage of $this-load-library() in the CI framework Usage of $this-load-library(). Share it with everyone for your reference, the details are as follows: My first time loading...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template