File tree Expand file tree Collapse file tree 4 files changed +21
-6
lines changed
Expand file tree Collapse file tree 4 files changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,11 @@ public function run(&$_data){
6060 }
6161 }else {
6262 // 调用第三方模板引擎解析和输出
63- $ class = 'Think \\Template \\Driver \\' .ucwords ($ engine );
63+ if (strpos ($ engine ,'\\' )){
64+ $ class = $ engine ;
65+ }else {
66+ $ class = 'Think \\Template \\Driver \\' .ucwords ($ engine );
67+ }
6468 if (class_exists ($ class )) {
6569 $ tpl = new $ class ;
6670 $ tpl ->fetch ($ _content ,$ _data ['var ' ]);
Original file line number Diff line number Diff line change @@ -37,8 +37,11 @@ class Cache {
3737 */
3838 public function connect ($ type ='' ,$ options =array ()) {
3939 if (empty ($ type )) $ type = C ('DATA_CACHE_TYPE ' );
40- $ type = strtolower (trim ($ type ));
41- $ class = 'Think \\Cache \\Driver \\' .ucwords ($ type );
40+ if (strpos ($ type ,'\\' )){ // 驱动类支持使用独立的命名空间
41+ $ class = $ type ;
42+ }else {
43+ $ class = 'Think \\Cache \\Driver \\' .ucwords (strtolower ($ type ));
44+ }
4245 if (class_exists ($ class ))
4346 $ cache = new $ class ($ options );
4447 else
Original file line number Diff line number Diff line change @@ -79,8 +79,12 @@ public function factory($db_config='') {
7979 if (empty ($ db_config ['dbms ' ]))
8080 E (L ('_NO_DB_CONFIG_ ' ));
8181 // 数据库类型
82- $ dbType = ucwords (strtolower ($ db_config ['dbms ' ]));
83- $ class = 'Think \\Db \\Driver \\' . $ dbType ;
82+ if (strpos ($ db_config ['dbms ' ],'\\' )){
83+ $ class = $ db_config ['dbms ' ];
84+ }else {
85+ $ dbType = ucwords (strtolower ($ db_config ['dbms ' ]));
86+ $ class = 'Think \\Db \\Driver \\' . $ dbType ;
87+ }
8488 // 检查驱动类
8589 if (class_exists ($ class )) {
8690 $ db = new $ class ($ db_config );
Original file line number Diff line number Diff line change @@ -34,7 +34,11 @@ class Log {
3434 // 日志初始化
3535 static public function init ($ config =array ()){
3636 $ type = isset ($ config ['type ' ])?$ config ['type ' ]:'File ' ;
37- $ class = 'Think \\Log \\Driver \\' . ucwords ($ type );
37+ if (strpos ($ type ,'\\' )){
38+ $ class = $ type ;
39+ }else {
40+ $ class = 'Think \\Log \\Driver \\' . ucwords (strtolower ($ type ));
41+ }
3842 unset($ config ['type ' ]);
3943 self ::$ storage = new $ class ($ config );
4044 }
You can’t perform that action at this time.
0 commit comments