note 90635 deleted from function.setcookie by danbrown

From: Date: Mon, 20 Jun 2011 15:31:46 +0000
Subject: note 90635 deleted from function.setcookie by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-180778@lists.php.net to get a copy of this message
Note Submitter: kyle [dot] florence [@t] gmail [dot] com ---- Here is a static Cookie wrapper class that you may find helpful: http://pastebin.com/f10a7bcba Example usage: <?php // Basic usage Cookie::set('testcookie', 'test'); print(Cookie::get('testcookie')); // You can set 'array' cookies in two different ways: Cookie::set('array[one]', 'item one'); Cookie::set(array('array' => 'two'), 'item two'); // Likewise, you can also get 'array' cookies in two different ways: print(Cookie::get('array[one]')); print(Cookie::get(array('array' => 'one'))); // Or you can grab the whole array at once: print_r(Cookie::get('array')); // Deleting cookies is done in the same way: Cookie::del('array[one]'); Cookie::del(array('array' => 'two')); // Delete the entire array: Cookie::del('array'); // Print contents of $_COOKIE (refresh for this) print '<pre>'; print_r(Cookie::contents()); print '<pre>'; ?>

« previous php.notes (#180778) next »