php针对iphone和android设备输出不同的viewport

php针对iphone和android设备输出不同的viewport


<?php

//if iphone
$browser = strpos($_SERVER['HTTP_USER_AGENT'],"iPhone");
  if ($browser == true){
  $browser = 'iphone';
}

//if android
$android = strpos($_SERVER['HTTP_USER_AGENT'],"Android");
   if ($android == true){
   $brower = 'android';
}

?>

<?php if ($browser == 'iphone') { ?>
  <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0" />
<?php } elseif ($brower == 'android') { ?>
  <meta name="HandheldFriendly" content="true" />
  <meta name="viewport" content="width=device-width, height=device-height, user-scalable=no" />
<?php } ?>


comments powered by Disqus