<?php require 'wxapi.php'; require 'model/message.php'; $code = $_GET['code']; $loc = $_GET['loc']; $wxapi = new WXapi(); $openid = $wxapi->getOpenid($code); //echo $openid; //通过openid在数据库查询如果已经购买过跳转到购买成功的页面 $message = new Message(); $good = $message->get($openid); if ($good) { header("Location:result.php?openid=" . $openid . '&loc=' . $loc); } else { header("Location:home.php?openid=" . $openid); }
<?php require 'wxapi.php'; $wxapi = new WXapi(); //控制是否在者里面查看 $loc = $_GET["loc"]; //进入之后进入微信的授权页面获取code //成功之后的跳转链接 $redirect_uri = 'http://www.casarover.com/casarover/activity/oauth.php?loc=' . $loc; $start_stup = $wxapi->start($redirect_uri);