| 1 | <?php |
||
| 10 | class CookieUtils { |
||
| 11 | /** |
||
| 12 | * Sends a cookie |
||
| 13 | * @param string $name the name of the cookie |
||
| 14 | * @param string $value The value of the cookie. |
||
| 15 | * @param int $duration default : 1 day |
||
| 16 | * @param string $path default : / the cookie will be available within the entire domain |
||
| 17 | */ |
||
| 18 | public static function set($name,$value,$duration=60*60*24,$path="/"){ |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Returns the Cookie with the name $name |
||
| 24 | * @param string $name |
||
| 25 | * @param string $default |
||
| 26 | * @return null|string |
||
| 27 | */ |
||
| 28 | public static function get($name,$default=null){ |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Removes the cookie with the name $name |
||
| 34 | * @param string $name |
||
| 35 | * @param $path |
||
| 36 | */ |
||
| 37 | public static function delete($name,$path="/"){ |
||
| 40 | |||
| 41 | /** |
||
| 42 | * Deletes all cookies |
||
| 43 | */ |
||
| 44 | public function deleteAll($path="/"){ |
||
| 49 | } |