|-原 Yii2报错 Object configuration must be an array containing a "class" or "__class" element.
yii2配置出错,提示对象配置必须是包含“类”元素的数组
在执行$model->save();时报的错,这个错误在网上找了半天没找到原因
Invalid Configuration – yii\base\InvalidConfigException Object configuration must be an array containing a "class" or "__class" element. 1. in D:\AppServ\www\wokan\vendor\yiisoft\yii2\BaseYii.phpat line 368 359360361362363364365366367368369370371372373374375376377 return static::$container->get($class, $params, $type); } if (isset($type['class'])) { $class = $type['class']; unset($type['class']); return static::$container->get($class, $params, $type); } throw new InvalidConfigException('Object configuration must be an array containing a "class" or "__class" element.'); } private static $_logger; /** * @return Logger message logger */ public static function getLogger() { 2. in D:\AppServ\www\wokan\vendor\yiisoft\yii2\validators\Validator.php at line 231– yii\BaseYii::createObject([0 => 'status', 1 => 'integer', 'attributes' => ['fid']]) 3. in D:\AppServ\www\wokan\vendor\yiisoft\yii2\base\Model.php at line 469– yii\validators\Validator::createValidator(['status'], common\models\Data, ['fid'], [0 => 'status', 1 => 'integer', 'attributes' => ['fid']]) 4. in D:\AppServ\www\wokan\vendor\yiisoft\yii2\base\Model.php at line 421– yii\base\Model::createValidators() 5. in D:\AppServ\www\wokan\vendor\yiisoft\yii2\base\Model.php at line 190– yii\base\Model::getValidators() 6. in D:\AppServ\www\wokan\vendor\yiisoft\yii2\base\Model.php at line 355– yii\base\Model::scenarios() 7. in D:\AppServ\www\wokan\vendor\yiisoft\yii2\db\ActiveRecord.php at line 564– yii\base\Model::validate(null) 8. in D:\AppServ\www\wokan\vendor\yiisoft\yii2\db\BaseActiveRecord.php at line 678– yii\db\ActiveRecord::insert(true, null) ......
继续找 20220414 03:21 ...
浏览更多内容请先登录。
立即注册
更新于:2022-04-14 14:02:54
相关内容
Yii2 报错代码整理
Yii2 HeadersAlreadySentException 报错
Yii2报错 Object configuration must be an array containing a "class" o...
Mysql错误1366的解决办法:Incorrect string value: '\xF0\x9F...' for ...
Yii2模型简介
Yii2模型简介-属性
Yii2模型简介-场景
Yii2模型简介-验证规则
Yii2模型简介-块赋值
Yii2模型简介-非安全属性
Yii2模型简介-数据导出
Yii2模型简介-字段
Yii2模型简介-最佳实践
Yii2小部件Widget
Yii2行为(Behavior)简介
揭秘yii2中行为的方法是如何注入到组件类中去的,应该说行为如何和组件关联的
推荐内容