Код: Выделить всё
public function actionStep1()
{
$value = Yii::$app->request->cookies->getValue('test');
Yii::$app->response->content = 'Cookie: ' . $value . '<br><a href="step2">step2</a>';
}
Код: Выделить всё
public function actionStep2()
{
Yii::$app->response->cookies->add(new Cookie([
'name' => 'test',
'value' => '123',
'expire' => time() + 60 * 60 * 24,
]));
}