<?php header("Content-type: text/html; charset=utf-8"); $user_agent = $_SERVER['HTTP_USER_AGENT']; if (strpos($user_agent, 'MicroMessenger') === false) { echo "<script>location.href='weixin://dl/business/?ticket=t6baf8f945bf29b5e770d9a8141685fbd#wechat_redirect';</script>";exit; } else { session_start(); } ?> |
function is_weixin(){ var ua = navigator.userAgent.toLowerCase(); if(ua.match(/MicroMessenger/i)=="micromessenger") { return true; } else { return false; } } if (!is_weixin()) { window.location.href = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxdf3f22ebfe96b912&redirect_uri=xxx&response_type=code&scope=snsapi_base&state=hyxt#wechat_redirect'; } |
转载请注明:PHP编程» PHP 只能在微信打开
标签: