12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- <?php
- // phpinfo();
- // exit;
- header("Content-Type:text/html;charset=utf-8");
- date_default_timezone_set('PRC'); // Asia/Shanghai
- // change the following paths if necessary
- $yii=dirname(__FILE__).'/framework/yii.php';
- if (isset($_SERVER['YII_ENV']))
- {
- define('YII_ENV', $_SERVER['YII_ENV']);
- }
- else
- {
- define('YII_ENV', 'development');
- }
- // 增加 APPLICATION_ENV 本地公用配置
- if (defined("YII_ENV") && file_exists(dirname(__FILE__) .'/protected/config/main.'. YII_ENV .'.php')) {
- $publicConfig = dirname(__FILE__) .'/protected/config/main.'. YII_ENV .'.php';
- } else {
- $publicConfig = dirname(__FILE__).'/protected/config/main.php';
- }
- /*
- *---------------------------------------------------------------
- * 错误报告
- *---------------------------------------------------------------
- *
- * 不同的环境需要不同程度的错误报告
- * 开发环境会显示错误报告, 测试及生产环境会隐藏错误报告
- */
- if (defined('YII_ENV')){
- switch (YII_ENV) {
- case 'local':
- @ini_set('display_errors', TRUE);
- error_reporting(-1);
- break;
- case 'development':
- @ini_set('display_errors', TRUE);
- error_reporting(E_ALL);
- //defined('YII_DEBUG') or define('YII_DEBUG',true);
- break;
- case 'testing':
- @ini_set('display_errors', TRUE);
- //报告运行时错误
- error_reporting(-1);
- //defined('YII_DEBUG') or define('YII_DEBUG',true);
- break;
- case 'production':
- error_reporting(0);
- break;
- default:
- exit(json_encode(array('code' => 500, 'message' => 'System environment settings are not correct!')));
- }
- }
- // remove the following lines when in production mode
- defined('YII_DEBUG') or define('YII_DEBUG',true);
- // specify how many levels of call stack should be shown in each log message
- defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
- //配置文件存储路径
- $configFile=dirname(__FILE__).DIRECTORY_SEPARATOR.'protected'.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'cache';
- $config =$configFile.DIRECTORY_SEPARATOR.'main.'.YII_ENV.'.php';;
- if (! file_exists($config)) {
- $config=$publicConfig;
- }
- // 加载自定义函数
- require_once(dirname(__FILE__) . '/protected/config/my_functions.php');
- require_once($yii);
- require_once(dirname(__FILE__) .'/protected/helper/yii.php');
- Yii::createWebApplication($config)->run();
|