如果iPad无法正常工作,则为PHP


php if ipad not working

<?php if(strstr($SERVER['HTTP_USER_AGENT'],'iPad')){ ?>
<link rel="stylesheet" type="text/css" href="http://artendijen.com/wp-content/themes/twentytwelve/styleTablet.css">
<?php } ?>

我正在尝试检测用户代理是否是iPad,但是上面的以下语法不起作用,我对css文件中的元素应用了显示none并删除了php if语句并检查了我的ipad,该元素不存在。

这是代码:

<?php if(stripos($SERVER['HTTP_USER_AGENT'],'iPad') !== false){ ?>
<!--here if its ipad-->
<link rel="stylesheet" type="text/css" href="http://artendijen.com/wp-content/themes/twentytwelve/styleTablet.css">
<?php } ?>

这是ipad的用户代理

Mozilla/5.0(iPad; U; CPU iPhone OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B314 Safari/531.21.10

请看这里