①在main.php的components数组加入
return [
//....
'components' => [
'view' => [
'renderers' => [
'tpl' => [
'class' => 'yii\smarty\ViewRenderer',
//'cachePath' => '@runtime/Smarty/cache',
],
],
],
],
];
<span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);">②安装composer</span>
切换到yii项目执行cmd
composer require smarty/smarty
③
composer require yiisoft/yii2-smarty