<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------

// [ 应用入口文件 ]
namespace think;

// 检测PHP环境
if(version_compare(PHP_VERSION,'5.6.0','<'))  die('PHP版本过低，最少需要PHP5.6，请升级PHP版本!!!!!!!!!');

// 定义应用目录
define('ROOT_PATH',	__DIR__ . '/../');
define('APP_PATH', ROOT_PATH.'application/');
// 加载基础文件
require __DIR__ . '/../thinkphp/base.php';
//设置时区
try {
    $defaultZone = "Asia/Shanghai";
    $timezone = \think\facade\Request::header()["timezone"] ?? $defaultZone;
    date_default_timezone_set($timezone);
} catch (Exception $exception) {
    date_default_timezone_set($defaultZone);
}
// 检查是否安装
if(!is_file('./../data/install.lock')) {
    define('INSTALL_ENTRANCE', true);
    Container::get('app')->bind('install')->run()->send();
} else {
    // 执行应用并响应
    Container::get('app', [APP_PATH])->run()->send();
}