mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-01 15:32:48 +08:00
视图层增加./的include的引入方法
This commit is contained in:
@@ -93,6 +93,8 @@ class Template
|
||||
*/
|
||||
protected ?CacheInterface $cache;
|
||||
|
||||
private string $fetchFile;
|
||||
|
||||
/**
|
||||
* 架构函数.
|
||||
* @param array $config
|
||||
@@ -226,6 +228,7 @@ class Template
|
||||
$template = $this->parseTemplateFile($template);
|
||||
|
||||
if ($template) {
|
||||
$this->fetchFile = $template;
|
||||
$cacheFile = $this->config['cache_path'] . $this->config['cache_prefix'] . md5($this->config['layout_on'] . $this->config['layout_name'] . $template) . '.' . ltrim($this->config['cache_suffix'], '.');
|
||||
|
||||
if (!$this->checkCache($cacheFile)) {
|
||||
@@ -1194,7 +1197,6 @@ class Template
|
||||
} else {
|
||||
$template = str_replace(['/', ':'], $this->config['view_depr'], substr($template, 1));
|
||||
}
|
||||
|
||||
if (str_starts_with($template, '@' . DIRECTORY_SEPARATOR)) {
|
||||
// 以@/开头,则从框架跟目录定位
|
||||
$app_path = $this->getConfig('view_root_path');
|
||||
@@ -1209,6 +1211,10 @@ class Template
|
||||
$view_app_path = $this->getConfig('base_view_path');
|
||||
|
||||
$template = str_replace('@', '', $template);
|
||||
} elseif (str_starts_with($template, '.' . DIRECTORY_SEPARATOR)) {
|
||||
$dirname = dirname($this->fetchFile);
|
||||
$template = $dirname . ltrim($template, '.') . '.' . ltrim($this->config['view_suffix'], '.');
|
||||
goto TEMPLATE_PARSED;
|
||||
} else {
|
||||
$app_path = $this->getConfig('app_path');
|
||||
$base_app_path = $this->getConfig('base_app_path');
|
||||
@@ -1230,7 +1236,7 @@ class Template
|
||||
|
||||
$template = $template_file_path;
|
||||
}
|
||||
|
||||
TEMPLATE_PARSED:
|
||||
if (is_file($template)) {
|
||||
// 记录模板文件的更新时间
|
||||
$this->includeFile[$template] = filemtime($template);
|
||||
|
||||
Reference in New Issue
Block a user