今天遇到一问题,让一个页面在微信上打开,PC上不能直接打开,下面是我使用的方法,现在分享给大家
<?php
$user_agent = $_SERVER['HTTP_USER_AGENT'];
if(strpos($user_agent,'MicroMessenger') === false){
header("Content-type: text/html; charset=utf-8");
echo '请在微信中打开';
die();
}
?>今天遇到一问题,让一个页面在微信上打开,PC上不能直接打开,下面是我使用的方法,现在分享给大家
<?php
$user_agent = $_SERVER['HTTP_USER_AGENT'];
if(strpos($user_agent,'MicroMessenger') === false){
header("Content-type: text/html; charset=utf-8");
echo '请在微信中打开';
die();
}
?>