在 common/main.php中配置 View 组件
‘view‘ => [ ‘renderers‘ => [ ‘tpl‘ => [ ‘class‘ => ‘yii\smarty\ViewRenderer‘, ‘cachePath‘ => ‘@runtime/Smarty/cache‘, ‘options‘ => [ ‘left_delimiter‘ => ‘{{‘, ‘right_delimiter‘ => ‘}}‘, ] ] ]
renderers 配置需要view 文件扩展名的解析类,上图tpl结尾的文件使用 yii\smarty\viewrenderer进行解析,请注意options配置smarty的符号
时间: 2024-10-12 19:34:45