/Cookie

A PHP Cookies Wrapper

Primary LanguagePHP

A PHP Cookie wrapper

Usage

Cookie::init(); // Very important.
Cookie::set('myvar1', 'myval'); // Set a cookie permanently
Cookie::set('myvar2', 'myval', false); // Set a cookie for current session
Cookie::set('myvar3', 'myval', '+1 day'); // Set a cookie for one day

Cookie:get('myvar1'); // Get value of cookie 'myvar1'
Cookie:get('myvar100'); // NULL
Cookie::clear('myvar2'); // Clear cookie 'myvar2'
Cookie::set('myvar2', null); // Also clears
Cookie::set('myvar3', 'val', -1000); // Also clears