标签:content style ret php 请求 ESS trace file tp5
方法介绍
1.sadd()
private function getJsApiTicket() { //==================Author D xx Start================= //1.缓存 WxJsapiTicket if (!$jsapiTicket = Cache::get(‘WxJsapiTicket‘)) { if (Cache::init()->handler()->sAdd(‘wxJsapiStorm‘, ‘11‘)) { //1.1获取 AccessToken $accessToken = $this->getAccessToken(); //1.2请求 $url = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?type=jsapi&access_token={$accessToken}"; $res = file_get_contents($url); trace($res); $res = json_decode($res); $jsapiTicket = $res->ticket; if (isset($jsapiTicket)) { //缓存 Cache::set(‘WxJsapiTicket‘, $jsapiTicket, 7000); } // 删除键 Cache::init()->handler()->delete(‘wxJsapiStorm‘); } else { sleep(1); $this->getJsApiTicket(); } } return $jsapiTicket; //==================Author D xx End================= }
标签:content style ret php 请求 ESS trace file tp5
原文地址:https://www.cnblogs.com/xdtx/p/9225598.html