
PHP跳转QQ聊天窗口源码
最近在整理TenApi.cn的接口,暂时没时间更新博客,放段代码我就溜~
此代码示例:https://docs.tenapi.cn/qq.html 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| <?php
error_reporting(E_ALL || ~E_NOTICE); $qq=@$_GET['qq'];
$agent = strtolower($_SERVER['HTTP_USER_AGENT']);
$is_pc = (strpos($agent, 'windows nt')) ? true : false; $is_iphone = (strpos($agent, 'iphone')) ? true : false; $is_ipad = (strpos($agent, 'ipad')) ? true : false; $is_android = (strpos($agent, 'android')) ? true : false;
if ($qq !=''){ $url='tencent://Message/?uin='.$qq; header("Location:{$url}"); if($is_pc){ $url='tencent://Message/?uin='.$qq; header("Location:{$url}"); } if($is_iphone){ $url='mqq://im/chat?chat_type=wpa&uin='.$qq.'&version=1&src_type=web'; header("Location:{$url}"); } if($is_android){ $url='mqqwpa://im/chat?chat_type=wpa&uin='.$qq; header("Location:{$url}"); } }else{ $Json = array( 'code' => 201, 'msg' => "请输入QQ号", ); $Json = json_encode($Json,JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE); echo stripslashes($Json); return $Json; } ?>
|