/** * Load class file function * @param string $classname class name * @param string $path extension address * @param Intger $initialize is initialized */ Private Static function_load_class ($classname,$path= ",$initialize= 1) {
Load_sys_class if $path is empty
$path ' model ' is Load_model
$path for ' modules ' +directory_separator+ $m +directory_separator+ ' classes ' is Load_app_classStatic $classes=Array(); if(Empty($path))$path= ' libs '. Directory_separator. ' Classes; $key=MD5($path.$classname); if(isset($classes[$key])) { if(!Empty($classes[$key])) { return $classes[$key]; } Else { return true; } } if(file_exists(Pc_path.$path. Directory_separator.$classname.‘. Class.php ')) { includePc_path.$path. Directory_separator.$classname.‘. Class.php '; $name=$classname; if($my _path= Self::my_path (Pc_path.$path. Directory_separator.$classname.‘. Class.php ')) { include $my _path; $name= ' My_ '.$classname; } if($initialize) { $classes[$key] =New $name; } Else { $classes[$key] =true; } return $classes[$key]; } Else { return false; } } /** * Load library * @param string $func function library name * @param string $path address*/ Private Static function_load_func ($func,$path= ' ') {
$path is empty the function becomes load_sys_func.
$path for ' modules '. Directory_separator. $m. Directory_separator. ' Functions ' is Load_app_func
Static $funcs=Array(); if(Empty($path))$path= ' libs '. Directory_separator. ' Functions; $path. = Directory_separator.$func.‘. Func.php '; $key=MD5($path); if(isset($funcs[$key]))return true; if(file_exists(Pc_path.$path)) { includePc_path.$path; } Else { $funcs[$key] =false; return false; } $funcs[$key] =true; return true; } /** * Load config file * @param string $file profile * @param string $key The configuration to get is recommended * @param string $default default configuration. This value occurs when the Get configuration item fails. * @param boolean $reload forced reload. */ Public Static functionLoad_config ($file,$key= ",$default= ",$reload=false) {
Returns the value corresponding to the "cache/$file"->keyStatic $configs=Array(); if(!$reload&&isset($configs[$file])) { if(Empty($key)) { return $configs[$file]; } ElseIf(isset($configs[$file][$key])) { return $configs[$file][$key]; } Else { return $default; } } $path= Cache_path. ' Configs '. Directory_separator.$file.‘. Php; if(file_exists($path)) { $configs[$file] =include $path; } if(Empty($key)) { return $configs[$file]; } ElseIf(isset($configs[$file][$key])) { return $configs[$file][$key]; } Else { return $default; } }
PHPCCMA Common function Records