123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160 |
- <?php
- /*
- |--------------------------------------------------------------------------
- | utf-8
- |--------------------------------------------------------------------------
- */
- header('Content-Type: text/html; charset=utf-8');
- if(!defined('DEVER_PROJECT'))
- {
- define('DEVER_PROJECT', 'default');
- }
- /*
- |--------------------------------------------------------------------------
- | date rpc
- |--------------------------------------------------------------------------
- */
- date_default_timezone_set("PRC");
- /*
- |--------------------------------------------------------------------------
- | start time
- |--------------------------------------------------------------------------
- */
- define('DEVER_START', microtime());
- /*
- |--------------------------------------------------------------------------
- | DEVER time
- |--------------------------------------------------------------------------
- */
- define('DEVER_TIME', $_SERVER['REQUEST_TIME']);
- /*
- |--------------------------------------------------------------------------
- | DEVER path
- |--------------------------------------------------------------------------
- */
- define('DEVER_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR);
- //require DEVER_PATH . 'include.php';
- /*
- |--------------------------------------------------------------------------
- | DEVER project host
- |--------------------------------------------------------------------------
- */
- if(isset($_SERVER['HTTP_HOST']))
- {
- define('DEVER_APP_HOST', 'http://' . $_SERVER['HTTP_HOST'] . ($_SERVER['SCRIPT_NAME'] ? substr($_SERVER['SCRIPT_NAME'], 0, strpos($_SERVER['SCRIPT_NAME'], 'index.php')) : DIRECTORY_SEPARATOR));
- }
- else
- {
- define('DEVER_APP_HOST', '');
- }
- /*
- |--------------------------------------------------------------------------
- | autoload
- |--------------------------------------------------------------------------
- */
- if(is_file(DEVER_PATH . 'build/dever.phar'))
- {
- require DEVER_PATH . 'build/dever.phar';
- if(is_file(DEVER_PATH . 'composer.json'))
- {
- require DEVER_PATH . 'vendor/autoload.php';
- }
- }
- else
- {
- require DEVER_PATH . 'vendor/autoload.php';
- }
- /*
- |--------------------------------------------------------------------------
- | init input
- |--------------------------------------------------------------------------
- */
- Dever\Http\Input::init();
- /*
- |--------------------------------------------------------------------------
- | load base config
- |--------------------------------------------------------------------------
- */
- Dever\Config\Load::get('base');
- /*
- |--------------------------------------------------------------------------
- | load debug config
- |--------------------------------------------------------------------------
- */
- Dever\Config\Load::get('debug');
- if(Dever\Config\Load::$global['debug']['error'])
- {
- /*
- |----------------------------------------------------------------------
- | error
- |----------------------------------------------------------------------
- */
- Dever\Debug\Process::report();
- }
- /*
- |--------------------------------------------------------------------------
- | DEVER app name
- |--------------------------------------------------------------------------
- */
- if(!defined('DEVER_APP_NAME'))
- {
- $temp = explode(Dever\Config\Load::$global['base']['path'], DEVER_APP_PATH);
- define('DEVER_APP_NAME', chop(str_replace(DIRECTORY_SEPARATOR, '_', end($temp)), '_'));
- }
- /*
- |--------------------------------------------------------------------------
- | DEVER header cache
- |--------------------------------------------------------------------------
- */
- if(isset(Dever\Config\Load::$global['base']['header-cache']) && Dever\Config\Load::$global['base']['header-cache'] == true)
- {
- header("Expires: -1");
- header("Cache-Control: no-store, private, post-check=0, pre-check=0, max-age=0", FALSE);
- header("Pragma: no-cache");
- }
- /*
- |--------------------------------------------------------------------------
- | load host config
- |--------------------------------------------------------------------------
- */
- Dever\Config\Load::get('host');
- /*
- |--------------------------------------------------------------------------
- | project register
- |--------------------------------------------------------------------------
- */
- Dever\Config\Project::register();
- /*
- |--------------------------------------------------------------------------
- | route
- |--------------------------------------------------------------------------
- */
- $route = new Dever\Routing\Route;
- /*
- |--------------------------------------------------------------------------
- | route run and out
- |--------------------------------------------------------------------------
- */
- if(!defined('DEVER_DAEMON'))
- {
- $route->runing()->output();
- }
|