hyperf-view/bin/hyperf.php

31 lines
1005 B
PHP

#!/usr/bin/env php
<?php
ini_set('display_errors', 'on');
ini_set('display_startup_errors', 'on');
ini_set('memory_limit', '1G');
error_reporting(E_ALL);
! defined('BASE_PATH') && define('BASE_PATH', dirname(__DIR__, 1));
! defined('SWOOLE_HOOK_FLAGS') && define('SWOOLE_HOOK_FLAGS', SWOOLE_HOOK_ALL);
! defined('START_TIME') && define('START_TIME', time()); // 启动时间
! defined('HF_VERSION') && define('HF_VERSION', '3.0'); // 定义hyperf版本号
require BASE_PATH . '/vendor/autoload.php';
// 载入公共函数库文件
foreach (glob(BASE_PATH . '/common/*') as $file) {
include_once($file);
}
// Self-called anonymous function that creates its own scope and keep the global namespace clean.
(function () {
Hyperf\Di\ClassLoader::init();
/** @var Psr\Container\ContainerInterface $container */
$container = require BASE_PATH . '/config/container.php';
$application = $container->get(Hyperf\Contract\ApplicationInterface::class);
$application->run();
})();