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

{app.params.name}} {app.params.name}} {app.params.name}}

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 } ?>



版权声明

davidzhang 创作并维护的 Gowhich 博客采用 创作共用保留署名-非商业-禁止演绎4.0国际许可证。

本文首发于 Gowhich 博客( https://www.gowhich.com ),版权所有,侵权必究。

本文永久链接: https://www.gowhich.com/blog/141

comments powered by Disqus