示例#1
0
function autoload($name)
{
    $name = class_to_file($name);
    $class_params = explode("_", $name);
    require 'component/' . $class_params[0] . '/' . $class_params[1] . '/' . $class_params[0] . '.php';
    return true;
}
示例#2
0
function autoload($name)
{
    $name = class_to_file($name);
    $class_params = explode("_", $name);
    if ($class_params[0] == 'int') {
        $type = _INTERFACE_;
    } elseif ($class_params[0] == 'mod') {
        $type = _MODULE_;
    } elseif ($class_params[0] == 'com') {
        $type = _COMPONENT_;
    } else {
        return false;
    }
    if (!isset($class_params[1])) {
        return false;
    }
    if (!isset($class_params[2])) {
        return false;
    }
    require $type . '/' . $class_params[1] . '/' . $class_params[2] . '/' . $class_params[1] . '.php';
    return true;
}