CI中的load方法是从哪来的

WBOY
Release: 2016-06-23 13:34:03
Original
952 people have browsed it

看CI默认文件中有
public function index()
{
$this->load->view('welcome_message');
}
按说这个load是一个方法,但是查了一下没有呢,怪事啊!难道他是php自带的函数不成


回复讨论(解决方案)

显然不是,如果是PHP自带的函数,最起码应该是load(); 而不是$this->load->xxx
既然是$this->load,也就是说,load实际上是Controller的一个成员。
CI_controller初始化的时候(system/core/Controller.php):
$this->load =& load_class('Loader', 'core');
换句话说,load实际上是Loader的实例,它是ci的加载器,主要负责CI的类库的加载,例如:
$this->load->config    //配置
$this->load->model //模型
$this->load->view   //视图。

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!