note 90635 added to function.setcookie

From: Date: Fri, 01 May 2009 19:00:10 +0000
Subject: note 90635 added to function.setcookie
Groups: php.notes 
Request: Send a blank email to php-notes+get-154084@lists.php.net to get a copy of this message
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>'; ?> ---- Server IP: 64.71.164.2 Probable Submitter: 68.82.6.9 ---- Manual Page -- http://www.php.net/manual/en/function.setcookie.php Edit -- https://master.php.net/note/edit/90635 Del: integrated -- https://master.php.net/note/delete/90635/integrated Del: useless -- https://master.php.net/note/delete/90635/useless Del: bad code -- https://master.php.net/note/delete/90635/bad+code Del: spam -- https://master.php.net/note/delete/90635/spam Del: non-english -- https://master.php.net/note/delete/90635/non-english Del: in docs -- https://master.php.net/note/delete/90635/in+docs Del: other reasons-- https://master.php.net/note/delete/90635 Reject -- https://master.php.net/note/reject/90635 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#154084) next »