CookiesController.php
file at
src/Controller/CookiesController.php
. Copy
the following code in the controller file.
src/Controller/Cookies/CookiesController.php
namespace App\Controller;
use App\Controller\AppController;
use Cake\Controller\Component\CookieComponent;
class CookiesController extends AppController{
public $components = array('Cookie');
public function writeCookie(){
$this->Cookie->write('name', 'Virat');
}
public function readCookie(){
$cookie_val = $this->Cookie->read('name');
$this->set('cookie_val',$cookie_val);
}
public function checkCookie(){
$isPresent = $this->Cookie->check('name');
$this->set('isPresent',$isPresent);
}
public function deleteCookie(){
$this->Cookie->delete('name');
}
}
?>
Create a directory
Do'stlaringiz bilan baham: |