/** * 初始化 * * @return void * @author Seven Du <*****@*****.**> **/ protected static function init() { self::$_root = dirname(__FILE__); /* # 设置时区 */ if (function_exists('date_default_timezone_set')) { date_default_timezone_set('Asia/Shanghai'); } /* 加载必要文件 */ self::import(self::getRootPath(), 'AutoLoader', 'TsAutoLoader', '.php'); }
/** * 初始化 * * @author Seven Du <*****@*****.**> **/ protected static function init() { self::$_root = dirname(__FILE__); /* # 设置时区 */ if (function_exists('date_default_timezone_set')) { date_default_timezone_set('Asia/Shanghai'); } /* 初始化数据库 */ self::$capsule = new Capsule(); self::$capsule->addConnection((array) (include TS_CONFIGURE . '/database.php')); self::$capsule->setEventDispatcher(new Dispatcher(new Container())); // Make this Capsule instance available globally via static methods... (optional) self::$capsule->setAsGlobal(); // Setup the Eloquent ORM... (optional; unless you've used setEventDispatcher()) self::$capsule->bootEloquent(); // 关闭日志功能 self::$capsule->connection()->disableQueryLog(); }