添加模板编译文件、缓存文件的安全代码
This commit is contained in:
parent
139e845cc0
commit
fb82505a07
framework/library
|
@ -67,8 +67,8 @@ class File implements CacheIfs
|
|||
if (is_array($value) || is_object($value)) {
|
||||
$value = json_encode($value);
|
||||
}
|
||||
$value = '<?php $timeout = ' . $timeout . '; ?>' . PHP_EOL . $value;
|
||||
if (file_put_contents($filename, $value)) {
|
||||
$content = '<?php if (!defined(\'APP_PATH\')) { exit; } $timeout = ' . $timeout . '; ?>' . PHP_EOL . $value;
|
||||
if (file_put_contents($filename, $content)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -487,7 +487,7 @@ class Engine
|
|||
// 处理定义的标签
|
||||
$template = $this->parseTags($template);
|
||||
|
||||
return $template;
|
||||
return '<?php if (!defined(\'APP_PATH\')) { exit; } ?>' . $template;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue