PHPCCMA Common function Records

Source: Internet
Author: User

    /** * 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_class
Static $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"->key
Static $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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.