1、实现效果通过config设置开关debug调试模式




2、debug调试模式设置和时区设置
error_reporting和display_errors点击查看详细讲解
php
public static function run(){
//定义常量
self::_set_const();
//创建模块目录
self::_mk_module();
//加载文件
self::_import_file();
self::_set_system();
//类自动加载
spl_autoload_register(array(__CLASS__,'_autoload'));
//运行框架
self::_run();
}
//设置调试模式debug
private static function _set_system(){
if(config('DEBUG')){
error_reporting(E_ALL);
ini_set('display_errors', 'On');
}else{
error_reporting(0);
ini_set('display_errors', 'Off');
}
date_default_timezone_set(config('DEFAYLT_TIME_ZONE'));
}
3、config.php设置开启调试模式和时区
php
<?php
return [
'DB_HOST'=>'localhost',//数据库地址
'DB_DATABASE'=>'test',//数据库
'DB_USER'=>'root',//数据库账号
'DB_PWD'=>'root',//数据库密码
'DEBUG'=>false,//调试模式
"DEFAYLT_TIME_ZONE"=>"PRC",//设置时区
];