dongshijiao6890 2013-12-02 06:08 采纳率: 0%
浏览 51
已采纳

php如果ipad不工作

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

  • 写回答

1条回答 默认 最新

  • duanba4942 2013-12-02 06:11
    关注

    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

    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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 win c++ socket
  • ¥15 CanMv K210开发板实现功能
  • ¥15 C# datagridview 栏位进度
  • ¥15 vue3页面el-table页面数据过多
  • ¥100 vue3中融入gRPC-web
  • ¥15 kali环境运行volatility分析android内存文件,缺profile
  • ¥15 写uniapp时遇到的问题
  • ¥15 vs 2008 安装遇到问题
  • ¥15 matlab有限元法求解梁带有若干弹簧质量系统的固有频率
  • ¥15 找一个网络防御专家,外包的