在用第二种方式的时候,就出现下面这个问题了
==========分割线===========
tp5我看跟zf2有相似的地方,想把模板文件的后缀由html改成phtml,发现改配置文件不好用,查了查tp5的View文件,发现它没有调用配置文件的信息
public function engine($options = [])
{
if (is_string($options)) {
$type = $options;
$options = [];
} else {
$type = !empty($options['type']) ? $options['type'] : 'Think';
}
$class = false !== strpos($type, '\\') ? $type : '\\think\\view\\driver\\' . ucfirst($type);
if (isset($options['type'])) {
unset($options['type']);
}
$this->engine = new $class($options);
return $this;
}本人在代码里做如下修改 public function engine($options = [])
{
if (is_string($options)) {
$type = $options;
$options = [];
} else {
$type = !empty($options['type']) ? $options['type'] : 'Think';
}
$class = false !== strpos($type, '\\') ? $type : '\\think\\view\\driver\\' . ucfirst($type);
if (isset($options['type'])) {
unset($options['type']);
}
//tu6ge 添加 todo
if(empty($options)){
$options = Config::get('template');
}
$this->engine = new $class($options);
return $this;
} 最佳答案