标签:
$local_url=‘http://‘.$_SERVER[‘SERVER_NAME‘].‘:‘.$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; $user_agent = $_SERVER [‘HTTP_USER_AGENT‘]; if (strpos ( $user_agent, ‘MicroMessenger‘ ) === false) { echo "<h4>请用微信扫一扫二维码打开</h4>"; echo "<img src=‘http://qr.liantu.com/api.php?text={$local_url}‘/>"; exit(); }else{ Session_start(); if($_GET[‘openid‘]){ $_SESSION[‘openid‘]=$_GET[‘openid‘]; unset($_GET[‘openid‘]); $get_url=http_build_query($_GET); /* foreach ($_GET as $k=> $v) { $get_url.="&".$k."=".$v; } */ $real_url="http://{$_SERVER [‘HTTP_HOST‘]}{$_SERVER[‘PHP_SELF‘]}?".urlencode($get_url); header ( "Location:" . $real_url ); }else{ if(!$_SESSION[‘openid‘]){ $local_urls=urlencode($local_url); $sit_oauth2="http://api.4vtk.com/wx_openid.php?back_url=".$local_urls; header ( "Location:" . $sit_oauth2 ); } } }
标签:
原文地址:http://www.cnblogs.com/yutaoyao/p/4447891.html