m0_49706191 2023-02-07 21:07 采纳率: 100%
浏览 11
已结题

php如何判断3个并输出

怎么把下面js写成api,请求方式 https://域名/api.php?qq=123456
访问后判断系统,安卓 苹果 pc电脑 跳转域名不同,然后跳转QQ api.php?qq=123456

<script type="text/javascript">
if(/Android/i.test(navigator.userAgent)) {
window.location.href = "https://wpa.qq.com跳转域名不同/msgrd?v=3&uin=".$_GET['这是QQ']."&site=qq&menu=yes";
}
if(/iPhone|/i.test(navigator.userAgent)) {
window.location.href = "https://wpa.qq.com跳转域名不同/msgrd?v=3&uin=".$_GET['这是QQ']."&site=qq&menu=yes";
}
if(/window/i.test(navigator.userAgent)) {
window.location.href = "https://wpa.qq.com跳转域名不同/msgrd?v=3&uin=".$_GET['这是QQ']."&site=qq&menu=yes";
}
<script>

  • 写回答

2条回答 默认 最新

  • 梦想橡皮擦 Python领域优质创作者 2023-02-07 21:12
    关注

    在 PHP 中实现上述功能

    <?php
    $qq = $_GET['qq'];
    $user_agent = $_SERVER['HTTP_USER_AGENT'];
    
    if (preg_match('/Android/i', $user_agent)) {
        header("Location: https://wpa.qq.com/android_domain?v=3&uin=$qq&site=qq&menu=yes");
    } elseif (preg_match('/iPhone/i', $user_agent)) {
        header("Location: https://wpa.qq.com/iphone_domain?v=3&uin=$qq&site=qq&menu=yes");
    } else {
        header("Location: https://wpa.qq.com/pc_domain?v=3&uin=$qq&site=qq&menu=yes");
    }
    
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 2月15日
  • 已采纳回答 2月7日
  • 修改了问题 2月7日
  • 创建了问题 2月7日

悬赏问题

  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序
  • ¥15 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录