### :-: **视图核心类**
引入Smarty
~~~php
<?php
namespace core;
use Smarty\Smarty;
use Smarty\SmartyException;
class View
{
/**
* 视图类 Smarty渲染显示
* @param $name string
* @param $path string
* @throws SmartyException
*/
public function smarty(string $name, string $path = '')
{
$smarty = new Smarty;
$smarty->setTemplateDir(BASE_PATH . 'view/'); // 设置模板目录
$smarty->setCompileDir(BASE_PATH . 'runtime/smarty/compile/');
$smarty->setConfigDir(BASE_PATH . 'config/smarty/');
$smarty->setCacheDir(BASE_PATH . 'runtime/smarty/cache/');
$smarty->debugging = true;
$smarty->assign($this->_assign ?: []);
$smarty->display($this->_controller . '/' . $name . '.html');
}
}
~~~