commit | author | age
|
e57e2f
|
1 |
<?php |
Z |
2 |
require "Mobile_Detect.php"; |
|
3 |
|
|
4 |
$_isCGI = (0 === strpos(PHP_SAPI, 'cgi') || false !== strpos(PHP_SAPI, 'fcgi')) ? 1 : 0; |
|
5 |
|
|
6 |
if ($_isCGI) { |
|
7 |
// CGI/FASTCGI模式下 |
|
8 |
$_temp = explode('.php', $_SERVER['PHP_SELF']); |
|
9 |
$_phpFile = rtrim(str_replace($_SERVER['HTTP_HOST'], '', $_temp[0] . '.php'), '/'); |
|
10 |
} else { |
|
11 |
$_phpFile = rtrim($_SERVER['SCRIPT_NAME'], '/'); |
|
12 |
} |
|
13 |
|
|
14 |
$_root = rtrim(dirname($_phpFile), '/'); |
|
15 |
$_root = ($_root == '/' || $_root == '\\') ? '' : $_root; |
|
16 |
|
|
17 |
$detect = new Mobile_Detect(); |
|
18 |
if ($detect->isMobile()) { |
|
19 |
if (file_exists("m.html")) { |
|
20 |
// 调用React生成的H5页面 |
|
21 |
echo file_get_contents("m.html"); |
|
22 |
} else { |
d3bc46
|
23 |
echo "移动端没有正确安装"; |
e57e2f
|
24 |
} |
Z |
25 |
} else { |
|
26 |
header('Location: ' . $_root . '/web/'); |
d3bc46
|
27 |
} |