Exception 'ReflectionException' with message 'Class require does not exist'
記錄一下今天遇到的錯誤
在使用
<?= $form->field($model, 'content')->textarea() ?>
的時候報錯
Exception 'ReflectionException' with message 'Class require does not exist'
in D:\phpStudy\WWW\vvv\vendor\yiisoft\yii2\di\Container.php:415
Stack trace:
#0 D:\phpStudy\WWW\clecssv2\vendor\yiisoft\yii2\di\Container.php(415): ReflectionClass->__construct('require')
#1 D:\phpStudy\WWW\clecssv2\vendor\yiisoft\yii2\di\Container.php(358): yii\di\Container->getDependencies('require')
#2 D:\phpStudy\WWW\clecssv2\vendor\yiisoft\yii2\di\Container.php(151): yii\di\Container->build('require', Array, Array)
#3 D:\phpStudy\WWW\clecssv2\vendor\yiisoft\yii2\BaseYii.php(344): yii\di\Container->get('require', Array, Array)
#4 D:\phpStudy\WWW\clecssv2\vendor\yiisoft\yii2\validators\Validator.php(206): yii\BaseYii::createObject(Array)
錯誤緣由是:php
public function rules(){ return [ [['content'],'require'], ];}少了一個d, required
歡迎關注本站公眾號,獲取更多信息