适用情况:比如提交一个表单,提交完成之后在页面展示一条提示消息. 控制器里面这样写: 单条消息: \Yii::$app->getSession()->setFlash('error', 'This is the message'); \Yii::$app->getSession()->setFlash('success', 'This is the message'); \Yii::$app->getSession()->setFlash('info', 'This i…
控制器里面这样写: 单条消息: 键值是规定好的,不要去自定义哦! \Yii::$app->getSession()->setFlash('error', 'This is the message'); \Yii::$app->getSession()->setFlash('success', 'This is the message'); \Yii::$app->getSession()->setFlash('info', 'This is the message');…
出错原因是: Object是php7.2中的保留类名,不可以使用Object作为类的名称. The object name was previously soft-reserved in PHP 7.0. This is now hard-reserved, prohibiting it from being used as a class, trait, or interface name. 执行 composer update 更新 Yii2的版本. 从Object.php文件的注释(在本地…