You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

33 lines
557 B

  1. <?php
  2. namespace Kuxin\Helper;
  3. /**
  4. * Class Json
  5. *
  6. * @package Kuxin\Helper
  7. * @author Pakey <pakey@qq.com>
  8. */
  9. class Json
  10. {
  11. /**
  12. * @param $data
  13. * @param int $format
  14. * @return string
  15. */
  16. public static function encode($data, $format = JSON_UNESCAPED_UNICODE)
  17. {
  18. return json_encode($data, $format);
  19. }
  20. /**
  21. * @param $data
  22. * @param bool $assoc
  23. * @return mixed
  24. */
  25. public static function decode($data, $assoc = true)
  26. {
  27. return json_decode($data, $assoc);
  28. }
  29. }