note 90623 deleted from function.setcookie by thiago

From: Date: Fri, 01 May 2009 02:17:09 +0000
Subject: note 90623 deleted from function.setcookie by thiago
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-154066@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 (#154066) next »