加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
index.php 1.78 KB
一键复制 编辑 原始数据 按行查看 历史
会微笑的糖果 提交于 2016-09-02 18:19 . 3.8.1 8235提交
<?php
/**
* 索引页
*
* @link http://www.ibos.com.cn/
* @copyright Copyright &copy; 2012-2014 IBOS Inc
* @author banyanCheung <banyan@ibos.com.cn>
*/
if ( version_compare( PHP_VERSION, '5.3.0', '<' ) ) {
die( 'require PHP > 5.3.0 !' );
}
// 程序根目录路径
define( 'PATH_ROOT', dirname( __FILE__ ) );
if ( $_SERVER['HTTP_HOST'] == 'saas.ibos.cn' ) {
include PATH_ROOT . '/login.php';
die;
}
$defines = PATH_ROOT . '/system/defines.php';
$yii = PATH_ROOT . '/library/yii.php';
$config = PATH_ROOT . '/system/config/common.php';
require_once ( $defines );
require_once ( $yii );
Yii::setPathOfAlias( 'application', PATH_ROOT . DIRECTORY_SEPARATOR . 'system' );
$str = strtolower( $_SERVER['SERVER_SOFTWARE'] );
list($server) = explode( '/', $str );
if ( $server == "apache" || $server == "nginx" || $server == "lighttpd" ) {
if ( isset( $_SERVER['HTTP_ORIGIN'] ) ) {
header( 'Access-Control-Allow-Origin: ' . $_SERVER['HTTP_ORIGIN'] );
}
header( 'Access-Control-Allow-Headers: Origin, Accept, Content-Type, Authorization, ISCORS' );
header( 'Access-Control-Allow-Credentials: true' );
header( 'Access-Control-Allow-Methods: POST, GET, PUT, OPTIONS, DELETE' );
if ( $_SERVER['REQUEST_METHOD'] == 'OPTIONS' ) {
exit();
}
} else if ( $server == "iis" ) {
if ( $_SERVER['REQUEST_METHOD'] == 'OPTIONS' ) {
// CORS 设置,有待讨论
if ( isset( $_SERVER['HTTP_ORIGIN'] ) ) {
header( 'Access-Control-Allow-Origin: ' . $_SERVER['HTTP_ORIGIN'] );
}
header( 'Access-Control-Allow-Headers: Origin, Accept, Content-Type, Authorization, ISCORS' );
header( 'Access-Control-Allow-Credentials: true' );
header( 'Access-Control-Allow-Methods: POST, GET, PUT, OPTIONS, DELETE' );
exit();
}
}
Yii::createApplication( 'application\core\components\Application', $config )->run();
exit;
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化