We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Yii::$app->db->createCommand()->insert('{{%sys_menu}}', [ 'id' => '1111', 'title' => '会员管理', 'cate_id' => '1', 'pid' => '0', 'url' => 'indexMember', 'icon' => 'fa-user', 'level' => '1', 'dev' => '0', 'sort' => '0', 'params' => '[]', 'status' => '1', 'tree' => 'tr_0', 'created_at' => '1553833327', 'updated_at' => '1563167436' ])->execute();
比如我这一段 params是一个json字段,直接插入进去,表里面会显示 "[]"而不是[],用拿出来解析其实是无法解析的,我看了下yii2的源码,yii\db\mysql\JsonExpression 的 44 行代码 $params[$placeholder] = Json::encode($value); 实际上yii2对json数据入库之前是进行了编码的,所以生成数据迁移的时候是否变成数组?例如
Yii::$app->db->createCommand()->insert('{{%sys_menu}}', [ 'id' => '1111', 'title' => '会员管理', 'cate_id' => '1', 'pid' => '0', 'url' => 'indexMember', 'icon' => 'fa-user', 'level' => '1', 'dev' => '0', 'sort' => '0', 'params' => json_decode('[]'), 'status' => '1', 'tree' => 'tr_0', 'created_at' => '1553833327', 'updated_at' => '1563167436' ])->execute();
The text was updated successfully, but these errors were encountered:
No branches or pull requests
比如我这一段 params是一个json字段,直接插入进去,表里面会显示 "[]"而不是[],用拿出来解析其实是无法解析的,我看了下yii2的源码,yii\db\mysql\JsonExpression 的 44 行代码 $params[$placeholder] = Json::encode($value); 实际上yii2对json数据入库之前是进行了编码的,所以生成数据迁移的时候是否变成数组?例如
The text was updated successfully, but these errors were encountered: