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