Home > php教程 > PHP源码 > body text

php原生模版 (芽)

PHP中文网
Release: 2016-05-23 17:09:59
Original
1465 people have browsed it

跳至

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.'');
	}
}
Copy after login

                   

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template