elite核心库的加载方式及自动加载类库

位于application的config文件:autoload.php是CI的可以指定自动加载的配置文件:

为了能自动加载elite的核心代码,需要以包的形式加载HMVC的MX文件,他们位于thirdpary文件夹中,和elite的位置。

代码中,一些类库为常用类库,故自动加载。自动加载的类库不宜很多,只需要加载核心和经常用的类库。

代码:

 1 $autoload['packages'] = array(
 2             realpath(APPPATH .'../elite'),    // elite Core
 3         APPPATH.'third_party'    
 4 );
 5 
 6 
 7 /*
 8 | -------------------------------------------------------------------
 9 |  Auto-load Libraries
10 | -------------------------------------------------------------------
11 | These are the classes located in the system/libraries folder
12 | or in your application/libraries folder.
13 |
14 | Prototype:
15 |
16 |    $autoload['libraries'] = array('database', 'email', 'xmlrpc');
17 */
18 
19 $autoload['libraries'] = array('database','events');
原文地址:https://www.cnblogs.com/kelite/p/2892153.html