前面用这个方法能够获取openid,但是现在获取不了了,什么原因?
public function GetOpenid() { //通过code获得openid if (!isset($_GET['code'])){ //触发微信返回code码 $scheme = $_SERVER['HTTPS']=='on' ? 'https://' : 'http://'; $uri = $_SERVER['PHP_SELF'].$_SERVER['QUERY_STRING']; if($_SERVER['REQUEST_URI']) $uri = $_SERVER['REQUEST_URI']; $baseUrl = urlencode($scheme.$_SERVER['HTTP_HOST'].$uri); $url = $this->__CreateOauthUrlForCode($baseUrl); Header("Location: $url"); exit(); } else { //获取code码,以获取openid $code = $_GET['code']; $openid = $this->getOpenidFromMp($code); return $openid; } }