顯示空白,http_crul也代入了
public function http_curl($url){
? ? ? ? ? ? ? ? $ch = curl_init();
? ? ? ? ? ? ? ? curl_setopt($ch,CURLOPT_URL,$url);
? ? ? ? ? ? ? ? curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
? ? ? ? ? ? ? ? $output = curl_exec($ch);
? ? ? ? ? ? ? ? curl_close($ch);
? ? ? ? ? ? ? ? return json_decode($output,true);
? ? ? ? ? ? ?}
//獲取用戶的openID
? ? public function getBaseInfo(){
? ? ? ? //1.獲取到code
? ? ? ? $appid="wxfbd13d9aff8a913a";
? ? ? ? $redirect_uri=urlencode("119.23.239.149/home/Login/getUserOpenId");
? ? ? ? $url="https://open.weixin.qq.com/connect/oauth2/authorize?appid=".$appid."&redirect_uri=".$redirect_uri."&response_type=code&scope=snsapi_base&state=123#wechat_redirect";
header("Location:$url"); ? ?
}
? ? public function getUserOpenId(){
? ? ? ? //2.獲取到網(wǎng)頁(yè)授權(quán)的access_token
? ? ? ? $appid="wxfbd13d9aff8a913a";
$code=input(code);
? ? ? ? $appsecret="09d05919edad8d9cea72902bd91073de";
? $url="https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=$appid&secret=$appsecret";
? ? ? ? $res=$this->http_curl($url);
? ? ? ? //3.拉取用戶的OPENDid
? ? }
2019-03-09
請(qǐng)問你最后解決了嗎