php - Cannot get queued cookie from request -


so have php controller sends cookie in queue, , need cookie next time when refresh page (and call controller).

when controller called, checks if cookie exists in request, if not, sets in queue expiration time 15 minutes.

but when controller called again, nothing got in request. i've looked in dev-tools->network->cookies , haven't found cookie neither in request nor in response section. @ same time, getqueuedqookies() shows cookie has been added queue. code looks follows:

$cookie = $this->request->cookie('id'); if($cookie=='id') {     die('id detected.'); } else {     $this->cookiejar->queue('id', 'id', 15); } 

then other actions taken, , controller returns string in end.

what doing wrong , how can problem solved? highly appreciate possible help!

update

change test function name , cookiejar auto injected.

public function test(cookiejar $cookiejar, request $request){     $cookie= $request->cookie('id');     if($cookie=='id') {         print('id detected.');     } else {         $cookiejar->queue(cookie('id', 'id', 15));     } } 

Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -