mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-09 08:02:48 +08:00
代码规范调整
This commit is contained in:
@@ -33,8 +33,8 @@ class View {
|
||||
/**
|
||||
* 模板变量赋值
|
||||
* @access public
|
||||
* @param mixed $name
|
||||
* @param mixed $value
|
||||
* @param mixed $name 变量名
|
||||
* @param mixed $value 变量值
|
||||
*/
|
||||
public function assign($name, $value = ''){
|
||||
if(is_array($name)) {
|
||||
@@ -66,7 +66,7 @@ class View {
|
||||
* @param array $config 引擎参数
|
||||
* @return View
|
||||
*/
|
||||
public function engine($engine,$config=[]){
|
||||
public function engine($engine, array $config = []){
|
||||
$class = '\\Think\\View\\Driver\\' . ucwords($engine);
|
||||
$this->engine = new $class($config);
|
||||
return $this;
|
||||
@@ -96,13 +96,13 @@ class View {
|
||||
* @access public
|
||||
* @param string $template 模板文件名
|
||||
* @param array $vars 模板输出变量
|
||||
* @param string $cacheId 模板缓存标识
|
||||
* @param string $cache_id 模板缓存标识
|
||||
* @return mixed
|
||||
*/
|
||||
public function display($template='',$vars=[],$cacheId='') {
|
||||
public function display($template = '', $vars = [], $cache_id = '') {
|
||||
Tag::listen('view_begin', $template);
|
||||
// 解析并获取模板内容
|
||||
$content = $this->fetch($template,$vars,$cacheId);
|
||||
$content = $this->fetch($template, $vars, $cache_id);
|
||||
// 输出内容过滤
|
||||
Tag::listen('view_filter', $content);
|
||||
// 输出模板内容
|
||||
@@ -118,10 +118,10 @@ class View {
|
||||
* @access protected
|
||||
* @param string $template 模板文件名或者内容
|
||||
* @param array $vars 模板输出变量
|
||||
* @param string $cacheId 模板缓存标识
|
||||
* @param string $cache_id 模板缓存标识
|
||||
* @return string
|
||||
*/
|
||||
protected function fetch($template,$vars=[],$cacheId='') {
|
||||
protected function fetch($template, $vars = [], $cache_id='') {
|
||||
if(!$this->config['http_render_content']) {
|
||||
$template = $this->parseTemplate($template);
|
||||
// 模板不存在 抛出异常
|
||||
@@ -133,7 +133,7 @@ class View {
|
||||
ob_start();
|
||||
ob_implicit_flush(0);
|
||||
if($this->engine) { // 指定模板引擎
|
||||
$this->engine->fetch($template,$vars,$cacheId);
|
||||
$this->engine->fetch($template, $vars, $cache_id);
|
||||
}else{ // 原生PHP解析
|
||||
extract($vars, EXTR_OVERWRITE);
|
||||
is_file($template) ? include $template : eval('?>' . $template);
|
||||
|
||||
Reference in New Issue
Block a user