<?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;

header("Access-Control-Allow-Credentials:true");
header("Access-Control-Allow-Origin:*");
header("Access-Control-Allow-Methods: *");
header('Access-Control-Allow-Headers:Origin,Referer,Content-Type,Accept,Token,X-Requested-With,token,User-Agent,Cookie,Set-Cookie,user-token');
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
    exit;
}

// 检测PHP环境
if(version_compare(PHP_VERSION,'5.6.0','<'))  die('PHP版本过低，最少需要PHP5.6，请升级PHP版本!');
header("Access-Control-Allow-Credentials:true");
header("Access-Control-Allow-Origin:*");
header("Access-Control-Allow-Methods: *");
header('Access-Control-Allow-Headers:Origin,Referer,Content-Type,Accept,Token,X-Requested-With,token,User-Agent,Cookie,Set-Cookie,user-token');
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
    exit;
}
// 定义应用目录
define('ROOT_PATH',	__DIR__ . '/../');
define('APP_PATH', ROOT_PATH.'application/');
// 加载基础文件
require __DIR__ . '/../thinkphp/base.php';

// 检查是否安装
if(!is_file('./../data/install.lock')) {
	define('INSTALL_ENTRANCE', true);
    Container::get('app')->bind('install')->run()->send();
} else {
	// 执行应用并响应
	Container::get('app')->run()->send();
}
