From 9a2ff2f23126d2ea7a2dd96987b2899bed93bb5f Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 10 Dec 2015 12:11:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E5=AE=9E=E4=BE=8B=E5=8C=96?= =?UTF-8?q?=E7=B1=BB=20=E5=91=BD=E5=90=8D=E7=A9=BA=E9=97=B4=E5=A4=A7?= =?UTF-8?q?=E5=B0=8F=E5=86=99=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/cache.php | 2 +- library/think/loader.php | 4 ++-- library/think/log.php | 2 +- library/think/template.php | 10 +++++----- library/think/view.php | 8 ++++---- mode/common.php | 5 +++-- 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/library/think/cache.php b/library/think/cache.php index 15ff26a6..55242cd7 100644 --- a/library/think/cache.php +++ b/library/think/cache.php @@ -29,7 +29,7 @@ class Cache public static function connect($options = []) { $type = !empty($options['type']) ? $options['type'] : 'File'; - $class = 'think\\cache\\driver\\' . strtolower($type); + $class = 'think\\cache\\driver\\' . ucwords($type); self::$handler = new $class($options); return self::$handler; } diff --git a/library/think/loader.php b/library/think/loader.php index fbb89de4..a4abe594 100644 --- a/library/think/loader.php +++ b/library/think/loader.php @@ -26,7 +26,7 @@ class Loader include self::$map[$class]; } else { // 命名空间自动加载 - $name = strstr($class, '\\', true); + $name = strtolower(strstr($class, '\\', true)); if (isset(self::$namespace[$name])) { // 注册的命名空间 $path = dirname(self::$namespace[$name]) . '/'; @@ -246,7 +246,7 @@ class Loader if (class_exists($class)) { $o = new $class(); if (!empty($method) && method_exists($o, $method)) { - $_instance[$identify] = call_user_func_array([ & $o, $method],[]); + $_instance[$identify] = call_user_func_array([ & $o, $method], []); } else { $_instance[$identify] = $o; } diff --git a/library/think/log.php b/library/think/log.php index ba0d7e94..f2b73b45 100644 --- a/library/think/log.php +++ b/library/think/log.php @@ -22,7 +22,7 @@ class Log public static function init($config = []) { $type = isset($config['type']) ? $config['type'] : 'File'; - $class = '\\think\\log\\driver\\' . strtolower($type); + $class = '\\think\\log\\driver\\' . ucwords($type); unset($config['type']); self::$storage = new $class($config); } diff --git a/library/think/template.php b/library/think/template.php index 1e9fa0cb..f6359280 100644 --- a/library/think/template.php +++ b/library/think/template.php @@ -19,9 +19,9 @@ namespace think; class Template { // 模板变量 - protected $data = []; + protected $data = []; // 引擎配置 - protected $config = [ + protected $config = [ 'tpl_path' => VIEW_PATH, // 模板路径 'tpl_suffix' => '.html', // 默认模板文件后缀 'cache_suffix' => '.php', // 默认模板缓存后缀 @@ -63,7 +63,7 @@ class Template // 初始化模板编译存储器 $type = $this->config['compile_type'] ? $this->config['compile_type'] : 'File'; - $class = '\\think\\template\\driver\\' . strtolower($type); + $class = '\\think\\template\\driver\\' . ucwords($type); $this->storage = new $class(); } @@ -658,10 +658,10 @@ class Template //模板函数过滤 $fun = strtolower(trim($args[0])); switch ($fun) { - case 'default': // 特殊模板函数 + case 'default': // 特殊模板函数 $name = '(' . $name . ')?(' . $name . '):' . $args[1]; break; - default: // 通用模板函数 + default: // 通用模板函数 if (!in_array($fun, $template_deny_funs)) { if (isset($args[1])) { if (strstr($args[1], '###')) { diff --git a/library/think/view.php b/library/think/view.php index 84c71e47..b4f5ff5c 100644 --- a/library/think/view.php +++ b/library/think/view.php @@ -62,7 +62,7 @@ class View * @param string $value 值 * @return View */ - public function config($config = '',$value='') + public function config($config = '', $value = '') { if (is_array($config)) { foreach ($this->config as $key => $val) { @@ -70,8 +70,8 @@ class View $this->config[$key] = $config[$key]; } } - }else{ - $this->config[$config] = $value; + } else { + $this->config[$config] = $value; } return $this; } @@ -85,7 +85,7 @@ class View */ public function engine($engine, array $config = []) { - $class = '\\think\\view\\driver\\' . strtolower($engine); + $class = '\\think\\view\\driver\\' . ucwords($engine); $this->engine = new $class($config); return $this; } diff --git a/mode/common.php b/mode/common.php index 1156e533..576e7a35 100644 --- a/mode/common.php +++ b/mode/common.php @@ -23,11 +23,12 @@ return [ 'think\Log' => CORE_PATH . 'log' . EXT, 'think\log\driver\File' => CORE_PATH . 'log' . DS . 'driver' . DS . 'file' . EXT, 'think\Config' => CORE_PATH . 'config' . EXT, + 'think\Create' => CORE_PATH . 'create' . EXT, 'think\Route' => CORE_PATH . 'route' . EXT, 'think\Exception' => CORE_PATH . 'exception' . EXT, 'think\Model' => CORE_PATH . 'model' . EXT, 'think\Db' => CORE_PATH . 'db' . EXT, - 'think\Db\Driver' => CORE_PATH . 'db'.DS.'driver' . EXT, + 'think\Db\Driver' => CORE_PATH . 'db' . DS . 'driver' . EXT, 'think\Template' => CORE_PATH . 'template' . EXT, 'think\view\driver\Think' => CORE_PATH . 'view' . DS . 'driver' . DS . 'think' . EXT, 'think\template\driver\File' => CORE_PATH . 'template' . DS . 'driver' . DS . 'file' . EXT, @@ -42,7 +43,7 @@ return [ 'think\Url' => CORE_PATH . 'url' . EXT, 'think\Debug' => CORE_PATH . 'debug' . EXT, 'think\Input' => CORE_PATH . 'input' . EXT, - 'think\Lang' => CORE_PATH . 'lang' . EXT + 'think\Lang' => CORE_PATH . 'lang' . EXT, ], 'init' => [],