34 lines
560 B
PHP
34 lines
560 B
PHP
<?php
|
|
/**
|
|
*
|
|
* @author jhx
|
|
* @date 2023/3/1 15:59
|
|
*/
|
|
|
|
namespace utils;
|
|
|
|
use think\Template;
|
|
|
|
class View
|
|
{
|
|
private static $instance;
|
|
|
|
private function __construct()
|
|
{
|
|
// 私有构造方法,防止外部实例化
|
|
}
|
|
|
|
public static function getInstance(): Template
|
|
{
|
|
if (null === static::$instance) {
|
|
static::$instance = new \think\Template(VIEW_CONFIG);
|
|
}
|
|
|
|
return static::$instance;
|
|
}
|
|
|
|
private function __clone()
|
|
{
|
|
// 私有克隆方法,防止外部克隆对象
|
|
}
|
|
} |