mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 23:22:48 +08:00
改进模板引擎类parseTemplateFile方法
This commit is contained in:
@@ -12,6 +12,7 @@
|
|||||||
namespace think;
|
namespace think;
|
||||||
|
|
||||||
use think\exception\TemplateNotFoundException;
|
use think\exception\TemplateNotFoundException;
|
||||||
|
use think\Request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ThinkPHP分离出来的模板引擎
|
* ThinkPHP分离出来的模板引擎
|
||||||
@@ -1061,14 +1062,18 @@ class Template
|
|||||||
{
|
{
|
||||||
if ('' == pathinfo($template, PATHINFO_EXTENSION)) {
|
if ('' == pathinfo($template, PATHINFO_EXTENSION)) {
|
||||||
if (strpos($template, '@')) {
|
if (strpos($template, '@')) {
|
||||||
// 跨模块调用模板
|
list($module, $template) = explode('@', $template);
|
||||||
$template = str_replace(['/', ':'], $this->config['view_depr'], $template);
|
|
||||||
$template = APP_PATH . str_replace('@', '/' . basename($this->config['view_path']) . '/', $template);
|
|
||||||
} else {
|
|
||||||
$template = str_replace(['/', ':'], $this->config['view_depr'], $template);
|
|
||||||
$template = $this->config['view_path'] . $template;
|
|
||||||
}
|
}
|
||||||
$template .= '.' . ltrim($this->config['view_suffix'], '.');
|
if (0 !== strpos($template, '/')) {
|
||||||
|
$template = str_replace(['/', ':'], $this->config['view_depr'], $template);
|
||||||
|
}
|
||||||
|
if ($this->config['view_base']) {
|
||||||
|
$module = isset($module) ? $module : Request::instance()->module();
|
||||||
|
$path = $this->config['view_base'] . ($module ? $module . DS : '');
|
||||||
|
} else {
|
||||||
|
$path = $this->config['view_path'];
|
||||||
|
}
|
||||||
|
$template = $path . $template . '.' . ltrim($this->config['view_suffix'], '.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_file($template)) {
|
if (is_file($template)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user