public function actionCookie() { // Yii::$app->response->format = Response::FORMAT_RAW; // $headers = Yii::$app->response->headers; // $headers->add('Content-type', 'image/gif'); // $headers->add('Content-Length', '42'); // $headers->add('Cache-Control', 'private, no-cache, no-cache=Set-Cookie, proxy-revalidate'); // $headers->add('Expires', 'Wed, 11 Jan 2000 12:59:00 GMT'); // $headers->add('Last-Modified', 'Wed, 11 Jan 2006 12:59:00 GMT'); // $headers->add('Pragma', 'no-cache'); // echo sprintf('%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%', 71, 73, 70, 56, 57, 97, 1, 0, 1, 0, 128, 255, 0, 192, 192, 192, 0, 0, 0, 33, 249, 4, 1, 0, 0, 0, 0, 44, 0, 0, 0, 0, 1, 0, 1, 0, 0, 2, 2, 68, 1, 0, 59); $clientCookie = new ClientCookie(); if ($clientCookie->cookie_id === null) { $cookie = new Cookie(); $cookie->last_activity = $cookie->create_time = date('Y-m-d H:i:s'); $cookie->save(); $clientCookie->cookie_id = $cookie->id; } else { $cookie = Cookie::findOne(['id' => $clientCookie->cookie_id]); if ($cookie !== null) { $cookie->last_activity = date('Y-m-d H:i:s'); $cookie->save(); } } // $clientCookie->updateCategory(3, [ // 'value' => 1 // ]); $clientCookie->save(); echo "<pre>"; VarDumper::dump($clientCookie); echo "</pre>"; }