-
-
Save mc256/26f2b4dc56d6187e9b83 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// 地址配置 | |
$iOSAPPStoreLink = '[iOS APP Store Link here]'; | |
$AndroidLink = '[APK Link here]'; | |
function redirect($url) { | |
header('Location: ' . $url); | |
exit(); | |
} | |
// 获取UA | |
$userAgent = $_SERVER['HTTP_USER_AGENT']; | |
// 检测 | |
$is_iOS = !!preg_match('/(iPad|iPhone|iPod)/i', $userAgent); | |
$is_Android = false !== strpos($userAgent, 'Android'); | |
$is_MicroMessenger = false !== strpos($userAgent, 'MicroMessenger'); | |
if ($is_iOS) { | |
redirect($iOSAPPStoreLink); | |
} else if ($is_Android) { | |
if (!$is_MicroMessenger) { | |
redirect($AndroidLink); | |
} | |
?> | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> | |
<meta charset="UTF-8"> | |
<title>移动客户端下载</title> | |
<style> | |
body { | |
background: #f0f0f0; | |
color: #333; | |
text-shadow: 1px 1px 0 #fff; | |
-webkit-text-shadow: 1px 1px 0 #fff; | |
font-size: 16px; | |
text-align: center; | |
line-height: 2; | |
padding-top: 40px; | |
} | |
</style> | |
</head> | |
<body> | |
您当前正在使用微信扫一扫<br>请点击右上角菜单选择“在浏览器中打开” | |
</body> | |
</html> | |
<?php | |
} else { | |
redirect('[APP Description Page Link here]'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment