helpers.php 477 B

123456789101112131415161718192021222324
  1. <?php
  2. // 检查是否已存在此函数,避免重复定义
  3. if (!function_exists('getDomain')) {
  4. /**
  5. * 获取当前请求的完整域名(包括协议)
  6. *
  7. * @return string
  8. */
  9. function getDomain() {
  10. return request()->getSchemeAndHttpHost();
  11. }
  12. }
  13. if (!function_exists('getHost')) {
  14. /**
  15. * 获取当前请求的主机名
  16. *
  17. * @return string
  18. */
  19. function getHost() {
  20. return request()->getHost();
  21. }
  22. }