2014-07-15 56 views

回答

1

使用PHP

<?php 
$iphone = strpos($_SERVER['HTTP_USER_AGENT'],"iPhone"); 
$android = strpos($_SERVER['HTTP_USER_AGENT'],"Android"); 
$palmpre = strpos($_SERVER['HTTP_USER_AGENT'],"webOS"); 
$berry = strpos($_SERVER['HTTP_USER_AGENT'],"BlackBerry"); 
$ipod = strpos($_SERVER['HTTP_USER_AGENT'],"iPod"); 

if ($iphone || $android || $palmpre || $ipod || $berry == true) 
{ 
header('Location: http://mobile.site.com/'); 
//OR 
echo "<script>window.location='http://mobile.site.com'</script>"; 
} 
?> 
相關問題