php两种include加载文件方式效率比较

继续完善“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');效率

相关文章
相关标签/搜索