View.php 857 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace app\controller;
  3. use ln\basic\BaseController;
  4. class View extends BaseController
  5. {
  6. public function mobile()
  7. {
  8. $siteName = systemConfig('site_name');
  9. $https = (parse_url(systemConfig('site_url'))['scheme'] ?? '') == 'https';
  10. $url = set_http_type($this->request->url(true), $https ? 0 : 1);
  11. $url .= (strpos($url, '?') === false ? '?' : '&');
  12. $url .= 'inner_frame=1';
  13. return \think\facade\View::fetch('/mobile/view', compact('siteName', 'url'));
  14. }
  15. public function h5()
  16. {
  17. if ((!$this->request->isMobile()) && (!$this->request->param('inner_frame')) && !strpos($this->request->server('HTTP_USER_AGENT'), 'MicroMessenger')) return $this->mobile();
  18. $DB = DIRECTORY_SEPARATOR;
  19. return view(app()->getRootPath() . 'public' . $DB . 'index.html');
  20. }
  21. }