首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > PHP >

_autoload函数加载的文件夹多,网站流量又大,那么对速度影响大么,该怎么解决

2012-06-03 
__autoload函数加载的文件夹多,网站流量又大,那么对速度影响大么__autoload函数加载的文件夹多,网站流量又

__autoload函数加载的文件夹多,网站流量又大,那么对速度影响大么
__autoload函数加载的文件夹多,网站流量又大,那么对速度影响大么!
function __autoload($className){
if(file_exists('model/'.$className.'.class.php')){
include_once('model/'.$className.'.class.php');
}
if(file_exists('Controller/'.$className.'.class.php')){
include_once('Controller/'.$className.'.class.php');
}

$prefix=$GLOBALS['groupName']=='main'?'':'../';
if(file_exists($prefix.'core/'.$className.'.class.php')){
include_once($prefix.'core/'.$className.'.class.php');
}
if(file_exists($prefix.'core/Smarty-3.1.6/'.$className.'.class.php')){
include_once($prefix.'core/Smarty-3.1.6/'.$className.'.class.php');
}
if(file_exists($prefix.'core/Smarty-3.1.6/sysplugins/'.$className.'.php')){
include_once($prefix.'core/Smarty-3.1.6/sysplugins/'.$className.'.php');
}

}

[解决办法]
我认为用__autoload影响不大,因为也只是一次调用__autoload去加载多个文件,而不是多次调用__autoload去加载多个文件.

热点排行