Cookie->setConfig('key', $key); } $this->set('ValueFromRequest', $this->request->getCookie('NameOfCookie')); $this->set('ValueFromCookieComponent', $this->Cookie->read('NameOfCookie')); } /** * action to set a cookie * * @param string|null $key Encryption key used. By defaults, * CookieComponent::_config['key']. */ public function set_cookie($key = null) { if (isset($key)) { $this->Cookie->setConfig('key', $key); } $this->Cookie->write('NameOfCookie', 'abc'); } public function remove_cookie($key) { $this->Cookie->delete($key); } }