View类engine参数更改为view_engine 避免冲突

This commit is contained in:
thinkphp
2016-03-14 09:39:31 +08:00
parent 47d09f2d0a
commit 588875a1be

View File

@@ -44,7 +44,7 @@ class View
// 视图驱动命名空间 // 视图驱动命名空间
'namespace' => '\\think\\view\\driver\\', 'namespace' => '\\think\\view\\driver\\',
// 模板引擎配置参数 // 模板引擎配置参数
'engine' => [ 'view_engine' => [
'type' => 'think', 'type' => 'think',
], ],
]; ];
@@ -55,12 +55,7 @@ class View
if (empty($this->config['view_path']) && defined('VIEW_PATH')) { if (empty($this->config['view_path']) && defined('VIEW_PATH')) {
$this->config['view_path'] = VIEW_PATH; $this->config['view_path'] = VIEW_PATH;
} }
$this->config['engine'] = array_merge($this->config['engine'], [ $this->engine($this->config['view_engine']['type'], $this->config['view_engine']);
'view_path' => $this->config['view_path'],
'view_suffix' => $this->config['view_suffix'],
'view_depr' => $this->config['view_depr'],
]);
$this->engine($this->config['engine']['type'], $this->config['engine']);
} }
/** /**
@@ -132,6 +127,11 @@ class View
$this->engine = 'php'; $this->engine = 'php';
} else { } else {
$class = $this->config['namespace'] . ucwords($engine); $class = $this->config['namespace'] . ucwords($engine);
$config = array_merge($config, [
'view_path' => $this->config['view_path'],
'view_suffix' => $this->config['view_suffix'],
'view_depr' => $this->config['view_depr'],
]);
$this->engine = new $class($config); $this->engine = new $class($config);
} }
return $this; return $this;