<?php

// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2021 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库3：https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库3：https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
// 允许的域名，可使用 '*' 表示允许所有域
// 设置跨域头

// echo "1";
// die;

namespace think;

// ini_set ('memory_limit', '1G');

// header('Access-Control-Allow-Origin:http://localhost:8080');
// header('Access-Control-Allow-Credentials:true');
// //    header('Cache-Control:no-cache');
// header('Access-Control-Allow-Methods:POST,GET,OPTIONS');
// header('Access-Control-Allow-Headers:Origin,x-requested-with,content-type,Accept');

require __DIR__ . '/../thinkphp/base.php';

$origin = $_SERVER['HTTP_ORIGIN'] ?? '';
$allow_domains = [
    'https://bravelove.top',
    'https://www.bravelove.top',
    'http://localhost:8080'
];
if (in_array($origin, $allow_domains)) {
    header("Access-Control-Allow-Origin: $origin");
    header("Access-Control-Allow-Credentials: true");
}
header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Authorization, lang, token");
header("Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS");
if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') {
    header("HTTP/1.1 204 No Content");
    exit;
}

Container::get('app')->run()->send();
