Exemplo n.º 1
0
 public static function start()
 {
     //注册AUTOLOAD方法
     spl_autoload_register('Core\\LWH::autoload');
     \Core\Storage::connect('File');
     //选择文件存储引擎
     $mode = (include LWH_PATH . 'Mode/' . APP_MODE . CONF_EXT);
     //模式配置文件
     //加载核心类与函数
     foreach ($mode['core'] as $file) {
         is_file($file) && (include $file);
     }
     //加载配置文件
     foreach ($mode['config'] as $file) {
         is_file($file) && C(include $file);
     }
     date_default_timezone_set(C('DEFAULT_TIMEZONE'));
     //设置时区
     //加载tags行为类
     //注册错误处理函数
     register_shutdown_function('Core\\LWH::fatalError');
     //致命错误处理
     set_error_handler('Core\\LWH::appError');
     //普通错误处理
     // set_exception_handler('Core\LWH::appException');//异常处理自定义throw new \Exception($e);
     \Core\App::run();
 }
Exemplo n.º 2
0
<?php

// Register autoloader
spl_autoload_register(function ($class) {
    $filename = dirname(__DIR__) . DIRECTORY_SEPARATOR . str_replace('\\', '/', $class) . '.php';
    if (is_readable($filename)) {
        require_once $filename;
    }
});
// Run app
use Core\App;
$app = new App();
$app->run();