
---
layout:     readme
title:      "视图类"
subtitle:   "View class"
date:       2019-01-11 20:00:00
author:     "吴庆宝"
tags:
    - phpms框架
---

CORE.'/phpmsframe.php';

```
public function assign($name,$value){
	$this->assign[$name]=$value;
}

public function display($file){
	$file_path = APP.'/views/'.$file;
	if(is_file($file_path)){	
		/***********twig模板***********/
		$loader = new \Twig_Loader_Filesystem(APP.'/views');
		$twig = new \Twig_Environment($loader, array(
		    'cache' => PHPMSFRAME.'/cache',
		    'debug'=>DEBUG,
		));						
		$template = $twig->load($file);			
		$template->display($this->assign?$this->assign:'');
		/***********twig模板end***********/

		/***********原生模板***********/
		//extract($this->assign);
		//include $file_path;
		/***********原生模板end***********/
	}
}
```	