SAASUtil.php 650 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace App\Saas;
  3. /**
  4. * SAAS系统业务操作工具栏
  5. *
  6. */
  7. class SAASUtil
  8. {
  9. /**
  10. * 生成一个随机的应用开发APPID,以fw字符开头并由数字和字母组成的18位字符串。
  11. *
  12. * @return 随机生成的APPID
  13. */
  14. public static function makeAppId()
  15. {
  16. return 'fw'.substr(md5(uniqid(mt_rand(),true)),8,16);
  17. }
  18. /**
  19. * 生成一个随机的应用开发APP密钥,由数字和字母组成的32位字符串。
  20. *
  21. * @return 随机生成的APP密钥
  22. */
  23. public static function makeAppSecret()
  24. {
  25. return md5(uniqid(mt_rand(),true));
  26. }
  27. }
  28. ?>