0

我在 Yii2(基本模板)中使用 Twig,但出现错误“ReflectionException Class yii\twig\ViewRenderer 在 Yii2 中不存在”。我在哪里可以修复它?

这是我的配置:

1. 在 web.php 中:

'view'=>[
'class'=>'yii\web\View',
'renderers'=>[
'twig'=>[
'class'=>'yii\twig\ViewRenderer',
'cachePath'=>'@runtime/Twig/cache',
'options' => YII_DEBUG ? [
'debug' => true,
'auto_reload' => true,] : [],
'extensions' => YII_DEBUG ?
['\Twig_Extension_Debug', : [],
'globals' => [
'html' => '\yii\helpers\Html',
'yii' => 'Yii'],

2.在composer.json中

"require": {
"php": ">=5.4.0",
"yiisoft/yii2": ">=2.0.5",
"yiisoft/yii2-bootstrap": "*",
"yiisoft/yii2-swiftmailer": "*",
"yiisoft/yii2-twig": "*"
},
4

0 回答 0