common.php 485 B

123456789101112131415161718
  1. <?php
  2. // Request Url
  3. function currentURL(): string
  4. {
  5. $protocol = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http");
  6. $host = $_SERVER['HTTP_HOST'] ?? 'localhost';
  7. $query = $_SERVER['REQUEST_URI'] ?? null;
  8. return sprintf("%s://%s%s", $protocol, $host, $query);
  9. }
  10. /*
  11. * 단말기 구분으로 레이아웃 처리
  12. */
  13. function layout(string $viewPath): string
  14. {
  15. return (DEVICE_TYPE != DEVICE_TYPE_1 ? ('mobile.' . $viewPath) : $viewPath);
  16. }