12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
- // 根路径 ROOT_PATH 定义, 5.3以后可以直接使用__DIR__
- // 所有被包含文件均须使用此常量确定路径
- define('ROOT_PATH', realpath(dirname(__FILE__)) . DIRECTORY_SEPARATOR);
- define('BASE_DIR', ROOT_PATH . '/../');
- define('ENV_LOCAL', 'local');
- define('ENV_DEV', 'dev');
- define('ENV_FORMAL', 'form');
- define('ENV_NEW', 'new');
- $fileName = __FILE__;
- // 仅仅用于IDE代码提示
- if (false) {
- define('FRAMEWORK_PATH', BASE_DIR . '../../framework/phpbase2/');
- } else if (strpos($fileName, '/data/webapps/') === 0 ) {
- if (strpos($fileName, '/test.') !== false || strpos($fileName, '/test-') !== false || strpos($fileName, '_test/') !== false) {
- define('CONF_PATH', '/data/webapps/conf_v2/test/');
- define('FRAMEWORK_PATH', '/data/webapps/framework/phpbase2_test/');
- $env = ENV_DEV;
- } elseif (strpos($fileName, '/new.') !== false || strpos($fileName, '/new-') !== false || strpos($fileName, '_new/') !== false) {
- define('CONF_PATH', '/data/webapps/conf_v2/new/');
- define('FRAMEWORK_PATH', '/data/webapps/framework/phpbase2_new/');
- $env = ENV_NEW;
- } else {
- define('CONF_PATH', '/data/webapps/conf_v2/form/');
- define('FRAMEWORK_PATH', '/data/webapps/framework/phpbase2/');
- $env = ENV_FORMAL;
- }
- } else if (strpos($fileName, '/data_dev/') === 0 ) {
- // 内网开发环境
- define('CONF_PATH', '/data/webapps/conf_v2/test/');
- $local = BASE_DIR . '../../framework/phpbase2/';
- if (file_exists($local)) {
- define('FRAMEWORK_PATH', $local);
- define('IS_ENV_LOCAL', true);
- } else {
- define('FRAMEWORK_PATH', '/data/webapps/framework/phpbase2_test/');
- }
- // 标识为内网开发环境,使用内网服务器的redis
- // $GLOBALS['IS_WEB_DEV'] = true;
- $env = ENV_DEV;
- } else {
- // 本地环境
- define('FRAMEWORK_PATH', BASE_DIR . '../../framework/phpbase2/');
- // define('FRAMEWORK_PATH', BASE_DIR . '../../php_new/trunk/framework/phpbase2/');
- define('CONF_PATH', FRAMEWORK_PATH . 'protected/conf/conf_ns/');
- // define('CONF_PATH', '/data/webapps/conf_v2/test/');
- define('IS_ENV_LOCAL', true);
- $env = ENV_DEV;
- }
- require_once FRAMEWORK_PATH . 'protected/common.php';
- require_once __DIR__ . '/vendor/autoload.php';
|