課程
/后端開(kāi)發(fā)
/PHP
/PHP微信公眾平臺(tái)開(kāi)發(fā)高級(jí)篇—生成二維碼接口
getWxAccessToken方法怎么獲得
2016-08-11
源自:PHP微信公眾平臺(tái)開(kāi)發(fā)高級(jí)篇—生成二維碼接口 1-2
正在回答
public function get_token(){
//將access_token存入session/cookie中
if($_SESSION['access_token'] && $_SESSION['expire_time']>time()){
return $_SESSION['access_token'];
}else{
$url="https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=".$this->appid."&secret=".$this->appsecret;
$json=$this->getCurl($url);
$arr=json_decode($json,true);
$_SESSION['access_token']=$arr['access_token'];
$_SESSION['expire_time']=time()+7200;
return $arr['access_token'];
}
? ? ? ?}
qian倩 提問(wèn)者
我發(fā)現(xiàn)這個(gè)代碼也無(wú)法使用呀
舉報(bào)
微信掃描,值得你擁有,本教程主要講解二維碼接口的實(shí)現(xiàn)
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購(gòu)課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
2016-08-14
public function get_token(){
//將access_token存入session/cookie中
if($_SESSION['access_token'] && $_SESSION['expire_time']>time()){
return $_SESSION['access_token'];
}else{
$url="https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=".$this->appid."&secret=".$this->appsecret;
$json=$this->getCurl($url);
$arr=json_decode($json,true);
$_SESSION['access_token']=$arr['access_token'];
$_SESSION['expire_time']=time()+7200;
return $arr['access_token'];
}
? ? ? ?}
2017-03-17
我發(fā)現(xiàn)這個(gè)代碼也無(wú)法使用呀