Ubiquity  2.0.0
php rapid development framework
UCookie.php
Go to the documentation of this file.
1 <?php
2 
4 
10 class UCookie {
11 
19  public static function set($name, $value, $duration=60*60*24, $path="/") {
20  \setcookie($name, $value, \time() + $duration, $path);
21  }
22 
29  public static function get($name, $default=null) {
30  return isset($_COOKIE[$name]) ? $_COOKIE[$name] : $default;
31  }
32 
38  public static function delete($name, $path="/") {
39  \setcookie($name, "", \time() - 3600, $path);
40  }
41 
45  public function deleteAll($path="/") {
46  foreach ( $_COOKIE as $name => $value ) {
47  self::delete($name, $path);
48  }
49  }
50 }