标签:
<?php Session_start(); /* * 微信端限制 */ $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{ if($_GET[‘openid‘]){ $_SESSION[‘openid‘]=$_GET[‘openid‘]; unset($_GET[‘openid‘]); foreach ($_GET as $k=> $v) { $get_url.="&".$k."=".$v; } $real_url="http://{$_SERVER [‘HTTP_HOST‘]}{$_SERVER[‘PHP_SELF‘]}?a=1".urlencode($get_url); header ( "Location:" . $real_url ); }else{ if(!$_SESSION[‘openid‘]){ $local_urls=urlencode($local_url); $sit_oauth2="http://api.4vtk.com/oauth2.php?back_url=".$local_urls; header ( "Location:" . $sit_oauth2 ); } } } ?>
标签:
原文地址:http://www.cnblogs.com/yutaoyao/p/4308151.html