How to set and get a cookie in Slim Framework?

Setting a cookie in Slim Framework will require a key, value, and specific time to allow the cookie to be present.



// With all parameters


// To set Cookie
$app->setCookie('bestinterviewquestion', 'bar', '2 days');

// To get Cookie
$app = new \Slim\Slim();
$foo = $app->getCookie('bestinterviewquestion');

Suggest An Answer

No suggestions avaliable!

Latest post from Slim Interview Questions

Ask Question