123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <?php
- /**
- * 统一初始化
- */
- /*error_reporting(E_ALL);
- ini_set('display_errors','On');
- */
- /** ---------------- 根目录定义,自动加载 ---------------- **/
- date_default_timezone_set('Asia/Shanghai');
- defined('API_ROOT') || define('API_ROOT', dirname(__FILE__) . '/..');
- require_once API_ROOT . '/PhalApi/PhalApi.php';
- $loader = new PhalApi_Loader(API_ROOT, 'Library');
- /** ---------------- 注册&初始化 基本服务组件 ---------------- **/
- //自动加载
- DI()->loader = $loader;
- //配置
- DI()->config = new PhalApi_Config_File(API_ROOT . '/Config');
- //调试模式,$_GET['__debug__']可自行改名
- //DI()->debug = !empty($_GET['__debug__']) ? true : DI()->config->get('sys.debug');
- DI()->debug = false;
- //日记纪录
- DI()->logger = new PhalApi_Logger_File(API_ROOT . '/Runtime', PhalApi_Logger::LOG_LEVEL_DEBUG | PhalApi_Logger::LOG_LEVEL_INFO | PhalApi_Logger::LOG_LEVEL_ERROR);
- //数据操作 - 基于NotORM,$_GET['__sql__']可自行改名
- //DI()->notorm = new PhalApi_DB_NotORM(DI()->config->get('dbs'), !empty($_GET['__sql__']));
- DI()->notorm = new PhalApi_DB_NotORM(DI()->config->get('dbs'), false);
- //翻译语言包设定
- SL('zh_cn');
- /** ---------------- 定制注册 可选服务组件 ---------------- **/
- require_once API_ROOT . '/Common/functions.php';
- if(!DI()->redis){
- DI()->redis=connectionRedis();
- }
- /* error_reporting(E_ALL);
- ini_set('display_errors', 'On'); */
- /**
- //签名验证服务
- DI()->filter = 'PhalApi_Filter_SimpleMD5';
- */
- /**
- //缓存 - Memcache/Memcached
- DI()->cache = function () {
- return new PhalApi_Cache_Memcache(DI()->config->get('sys.mc'));
- };
- */
- /**
- //支持JsonP的返回
- if (!empty($_GET['callback'])) {
- DI()->response = new PhalApi_Response_JsonP($_GET['callback']);
- }
- */
- /* 七牛上传 */
- DI()->qiniu = new Qiniu_Lite();
-
- /* 本地/云 上传 */
- DI()->ucloud = new UCloud_Lite();
|