简体   繁体   English

PHP的,如果iPad无法正常工作

[英]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 } ?>

I am trying to detect if the user agent is iPad, but the following syntax above does not work, I applied a display none to an element in the css file and removed the php if statement and checked my ipad and the element was not there. 我正在尝试检测用户代理是否为iPad,但是上面的以下语法不起作用,我对CSS文件中的元素应用了display none的显示,并删除了php if语句,并检查了我的ipad和该元素是否不存在。

Here is the code: 这是代码:

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

This is what user agent for ipad 这就是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

Please see here 请看这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM