首页  >  文章  >  php教程  >  php原生模版 (芽)

php原生模版 (芽)

PHP中文网
PHP中文网原创
2016-05-23 17:09:591418浏览

跳至

getHtml($fileName);
		die($this->html);
	}
	
	//捕获输出
	public function fetch($fileName){
		$this->getHtml($fileName);
		return $this->html;
	}
	
	//添加过滤器
	public function loadFilter($filterName){
		$this->filters[] = $filterName;
	}
	
	private function getHtml($fileName){
		//检查文件是否存在
		if(!file_exists($fileName)){
			self::toError(basename($fileName).'文件不存在。');
		}
		
		//将输出缓存保存到变量
		ob_start();
		include($fileName);
		$this->html = ob_get_clean();
		
		//执行处理器函数……
		
	}

	//错误输出
	private static function toError($error){
		header('HTTP/1.0 500 Internal Server Error');
		die('Internal Server ErrorPHPTemplate: '.$error.'');
	}
}

                   

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn