note 127259 deleted from book.curl by cmb
| From: | cmb@php.net | Date: | Tue, 12 Jul 2022 08:45:11 +0000 |
| Subject: | note 127259 deleted from book.curl by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-218973@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
function Token(){
$redis=new Redis();
$access_token=$redis->get('access_token');
if (empty($access_token)){
$url=sprintf(config('wx.phoneUrl'),config('wx.appId'),config('wx.AppSecret'));
$obj=file_get_contents($url);
$arr=json_decode($obj,true);
$redis->set('access_token',$arr['access_token'],$arr['expires_in']);
$access_token=$arr['access_token'];
}
return $access_token;
}