设置cookie后提示:The cookie collection is read only.
use yii\web\Cookie;
$cookies = \Yii::$app->request->cookies;
$cookieArr = array('name'=>'user','value'=>'zhangsan1');
$cookies->add(new Cookie($cookieArr));
use yii\web\Cookie;
$cookies = \Yii::$app->request->cookies;
$cookieArr = array('name'=>'user','value'=>'zhangsan1');
$cookies->add(new Cookie($cookieArr));
2020-07-05
正好这两天在看YII2框架,这里补充一下,即使不调用validate(),在save()的时候,会自动去校验数据的。如果放心数据来源的话,save(false)可以跳过校验。
2018-12-19