繼續完善「X計劃」的核心部分,核心嘛,就要加載必須的文件,嘗試了兩種方法,發現效率是不一樣的,分享一下吧~ 先來講說兩種方式:php
1)定義一個字符串變量,裏面保存要加載的文件列表。而後foreach加載。 $a = '/a.class.php;/Util/b.class.php;/Util/c.class.php'; $b = '/d.php;/e.class.php;/f.class.php;/g.class.php';ui
// 加載基本系統文件 $kernel_require_files = explode(';', $a);//SYS_REQUIRE_LIB_FILE_LIST); foreach($kernel_require_files as $f){ require_once(SYS_LIB_PATH.'/System'.$f); }字符串
// 加載基本系統文件 $kernel_require_files = explode(';', $b);//SYS_BASE_FILE_LIST); foreach($kernel_require_files as $f){ require_once(KERNEL_PATH.$f); }io
2)把全部的要加載的文件都在一個include文件裏面加載,當前頁直接include這個include文件。 include.php文件內容 require_once('func.php'); require_once('LangManager.class.php'); require_once('_KernelAutoLoader.class.php'); require_once('ApplicationSettingManager.class.php');class
require_once('lib/System/Activator.class.php'); require_once('lib/System/Util/CXML.class.php'); require_once('lib/System/Util/CWeb.class.php');效率