As shown in the picture:
html css code:
This is how the YII template is written
1 欢迎使用Yii 2 <style> 3 4 div.success{ 5 background: #C5FBBD; 6 border: 1px solid #76C376; 7 padding: 10px; 8 margin: 10px 0; 9 }10 11 div.error12 {13 background: #FFE0E1;14 border: 1px solid #FFA0A2;15 padding: 10px;16 margin: 10px 0;17 }18 19 </style>20 21 <?php if(Yii::app()->user->hasFlash('success')) { ?>22 <div class="success"><?php echo Yii::app()->user->getFlash('success'); ?></div>23 <?php } ?>24 25 26 <?php if(Yii::app()->user->hasFlash('error')) { ?>27 <div class="error"><?php echo Yii::app()->user->getFlash('error'); ?></div>28 <?php } ?>
I also posted a small function point