Esempio n. 1
0
version_compare(PHP_VERSION, $min_version = "5.6") === -1 and exit('当前PHP运行版本[' . PHP_VERSION . "]低于[" . $min_version . "]!");
// 拒绝标志
define('IS_NORMA', true);
// 开始运行时间
define('START_TIME', microtime(true));
// 内存使用
define('START_MEM', memory_get_usage());
// 框架路径
defined('FRAME_PATH') or define('FRAME_PATH', __DIR__ . DIRECTORY_SEPARATOR);
// 应用目录
defined('APP_PATH') or define('APP_PATH', dirname(__DIR__) . '/manage');
// 应用前缀
defined('APP_UUID') or define('APP_UUID', substr(md5(APP_PATH), 5, 6));
require FRAME_PATH . '/bootstrap/autoload.php';
// 编译文件库
if (file_exists($compiledPath = APP_PATH . '/cache/compiled.php')) {
    require $compiledPath;
}
//如果不处于单元测试
if (strpos($_SERVER['PHP_SELF'], 'phpunit') === false) {
    switch (strtoupper(\Norma\Support\Evn::DetectAccessMode())) {
        case 'CLI':
            \Norma\Task::Using($argc, $argv)->Running();
            break;
        case 'WEB':
        default:
            \Norma\App::listen(new \Norma\Request());
            //->send();
            break;
    }
}
Esempio n. 2
0
// +----------------------------------------------------------------------
// | Author:  LunnLew <*****@*****.**>
// +----------------------------------------------------------------------
//  加载函数库
require FRAME_PATH . '/functions.php';
// 注册框架类加载器
require FRAME_PATH . '/Support/Traits/LoaderHelper.php';
require __DIR__ . '/Loader.php';
// 注册类加载器
$loader = new \Norma\Loader();
$loader->register();
$loader->addNamespace('Norma', FRAME_PATH);
\Norma\App::$loader = $loader;
// 注册错误和异常处理机制
\Norma\Error::register();
// 加载Composer库
defined('COMPOSER_VENDOR_PATH') and (require_once COMPOSER_VENDOR_PATH . '/autoload.php');
// 加载默认全局配置文件
\Norma\Config::load(FRAME_PATH . '/Config/Global-default.php');
// 加载应用配置文件
\Norma\Config::load(APP_PATH . '/Config/Global.php');
// 平台兼容支持
\Norma\Constant::LoadDefineWith([\Norma\Support\Evn::DetectOS(), function () {
    \Norma\Support\Evn::DetectEngine();
    if (!empty(\Norma\Support\Evn::$runEngineEx)) {
        \Norma\Constant::LoadDefineWith(\Norma\Support\Evn::$runEngineEx, FRAME_PATH . '/Compatibility');
    }
    return \Norma\Support\Evn::$runEngine;
}, \Norma\Support\Evn::DetectAccessMode()], FRAME_PATH . '/Compatibility');
// 加载插件
\Norma\Hook::loadPlugin(FRAME_PATH . '/Plugin');