php如何判断微信端打开的页面?
1个回答
展开全部
根据浏览器信息作出判断,也有可能被模拟 = =
header("Content-type: text/html; charset=utf-8");
$user_agent = $_SERVER['HTTP_USER_AGENT'];
if (strpos($user_agent, 'MicroMessenger') === false) {
echo "禁止浏览,请在微信中打开本站";exit;
} else {
session_start();
}
header("Content-type: text/html; charset=utf-8");
$user_agent = $_SERVER['HTTP_USER_AGENT'];
if (strpos($user_agent, 'MicroMessenger') === false) {
echo "禁止浏览,请在微信中打开本站";exit;
} else {
session_start();
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询