【发布时间】:2015-09-03 15:37:17
【问题描述】:
我正在尝试调用一个 php 文件,该文件仅在有人单击非 android 或 iOS 设备上的链接时才会打开。在我只有一条错误消息之前。
if(isset($_GET['appId'])){
$products = getAppDownloadLinks(mysql_string($_GET['appId']));
//do something with this information
if( $iPod || $iPhone || $iPad){
header('Location: '.$products['ios']);
exit;
}
else if($Android){
header('Location: '.$products['android']);
exit;
}
else{
//we're not a mobile device.
$html = file_get_contents('mobileSplash.php');
}
}
这是我最后的 else 语句的合适方法,我如何调用该 php 文件来显示启动错误页面?
【问题讨论】:
-
你应该检查这个链接:stackoverflow.com/questions/14646918/… :)
-
我个人会使用像 mobiledetect.net 这样的库(以防算法是从头开始制作的)
标签: php