#1 youngqj
$GLOBALS['G_SP']["inst_class"][$class_name];
if(isset($GLOBALS['G_SP']["import_file"][md5($sfilename)]))return TRUE;
分别是 function spClass 和function import 里的 不明白 是啥意思 老大有时间解释一下 谢谢啊
2010-04-29 09:58:02
$GLOBALS['G_SP']["inst_class"][$class_name];
if(isset($GLOBALS['G_SP']["import_file"][md5($sfilename)]))return TRUE;
2010-04-29 09:58:02
2010-04-29 10:14:20
2010-04-29 11:07:11
2010-04-29 11:07:38
/**
* import 载入包含文件
*
* @param filename 需要载入的文件名或者文件路径
* @param auto_search 载入文件找不到时是否搜索系统路径或文件,搜索路径的顺序为:应用程序包含目录 -> 应用程序Model目录 -> sp框架包含文件目录
* @param auto_error 自动提示扩展类载入出错信息
*/
function import($sfilename, $auto_search = TRUE, $auto_error = FALSE)
{
if(isset($GLOBALS['G_SP']["import_file"][md5($sfilename)]['c']))return TRUE;
if( TRUE == @is_readable($sfilename) ){
require($sfilename);
$GLOBALS['G_SP']['import_file'][md5($sfilename)]['c'] = TRUE;
$GLOBALS['G_SP']['import_file'][md5($sfilename)]['f'] = $sfilename;
return TRUE;
}else{
if(TRUE == $auto_search){
foreach(array_merge( array($GLOBALS['G_SP']['sp_include_path']),
array($GLOBALS['G_SP']['model_path']),
array($GLOBALS['G_SP']['include_path']) ) as $sp_include_path){
if(isset($GLOBALS['G_SP']["import_file"][md5($sp_include_path.'/'.$sfilename)]['c']))return TRUE;
if( is_readable( $sp_include_path.'/'.$sfilename ) ){
require($sp_include_path.'/'.$sfilename);
$GLOBALS['G_SP']['import_file'][md5($sp_include_path.'/'.$sfilename)]['c'] = TRUE;
$GLOBALS['G_SP']['import_file'][md5($sp_include_path.'/'.$sfilename)]['f'] = $sp_include_path.'/'.$sfilename;
return TRUE;
}
}
}
}
if( TRUE == $auto_error ){
spError('未能找到名为:{$sfilename}的文件');
}
return FALSE;
}
class main extends spController
{
function index(){
spClass("spPager");
dump($GLOBALS['G_SP']["import_file"]);
foreach ($GLOBALS['G_SP']["inst_class"] as $key => $data){
echo $key .'
';
}
unset($key,$data);
}
Array
(
[bfcf58e3ce9367158528de506fac3a3c] => Array
(
[c] => 1
[f] => G:/speedamp2/htdocs/sp3/Core/spController.php
)
[944d6caee3a862ae9c06eb263d1a423b] => Array
(
[c] => 1
[f] => G:/speedamp2/htdocs/sp3/Core/spModel.php
)
[10e4a92671cda145aa1e31944a283348] => Array
(
[c] => 1
[f] => G:/speedamp2/htdocs/sp3/Core/spView.php
)
[67e2fdfdc952757c0d5a7908e50f1025] => Array
(
[c] => 1
[f] => G:\speedamp2\htdocs\new/controller/main.php
)
[7e6d9f3c628391124a4377a448265157] => Array
(
[c] => 1
[f] => G:/speedamp2/htdocs/sp3/Drivers/Smarty/Smarty.class.php
)
)
Smarty
spView
main
spPager
2010-04-29 11:40:50