fix:更新已知bug,优化代码
This commit is contained in:
37
support/Template.php
Normal file
37
support/Template.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace support;
|
||||
|
||||
use Psr\SimpleCache\InvalidArgumentException;
|
||||
use support\view\ThinkPHP;
|
||||
use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\DbException;
|
||||
use think\db\exception\ModelNotFoundException;
|
||||
|
||||
/**
|
||||
* 模板类
|
||||
* Class Template
|
||||
* @package support
|
||||
* @method static string fetch(string $template = '', array $vars = [], array $config = [])
|
||||
*/
|
||||
class Template extends ThinkPHP
|
||||
{
|
||||
/**
|
||||
* @param string $template
|
||||
* @param array $vars
|
||||
* @param string|null $app
|
||||
* @return array|false|string|string[]|null
|
||||
* @throws DataNotFoundException
|
||||
* @throws DbException
|
||||
* @throws InvalidArgumentException
|
||||
* @throws ModelNotFoundException
|
||||
*/
|
||||
public static function render(string $template, array $vars, string $app = null)
|
||||
{
|
||||
$content = parent::render($template, $vars, $app);
|
||||
if (saenv('minify_page')) {
|
||||
$content = preg_replace('/\s+/i', ' ', $content);
|
||||
}
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user