Cookie.php 546 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace App\Utils;
  3. class Cookie
  4. {
  5. public static function set($arg, $time)
  6. {
  7. foreach ($arg as $key => $value) {
  8. setcookie($key, $value, $time, '/');
  9. }
  10. }
  11. public static function setwithdomain($arg, $time, $domain)
  12. {
  13. foreach ($arg as $key => $value) {
  14. setcookie($key, $value, $time, '/', $domain);
  15. }
  16. }
  17. public static function get($key)
  18. {
  19. if (isset($_COOKIE[$key])) {
  20. return $_COOKIE[$key];
  21. }
  22. return "";
  23. }
  24. }