<?php /** * * @authors Your Name (you@example.org) * @date 2017-09-20 14:10:30 * @version $Id$ */ //TPL继承smarty final class TPL extends Smarty { //用于存放实例化的对象 private static $_instance = null; //公共静态方法获取实例化的对象 public static function getInstance() { if (!(self::$_instance instanceof self)) { self::$_instance = new self(); } return self::$_instance; } //私有克隆 private function __clone() {} //防止被反序列 private function __wakeup() {} //私有构造 private function __construct() { //echo "b" . var_dump($this); $this->setConfigs(); } //重写Smarty配置 private function setConfigs() { //模板目录 $this->template_dir = ROOT_PATH . '/view/'; //编译目录 $this->compile_dir = ROOT_PATH . '/compile/'; //配置变量目录 $this->config_dir = ROOT_PATH . '/configs/'; //缓存目录 $this->cache_dir = ROOT_PATH . '/cache/'; //是否开启缓存,网站开发调试阶段,我们应该关闭缓存 $this->caching = 0; //缓存的声明周期 $this->cache_lifetime = 60 * 60 * 24; //左定界符 $this->left_delimiter = '{'; //右定界符 $this->right_delimiter = '}'; } }