标签:
$confinfo = $this->js_sdk("wx3bd22c50ac87af81","1289bab67c6de6c327160349b85d8de0"); //千化 $this->assign("confinfo",$confinfo);
protected function js_sdk($appid,$appsecret){ $protocol = (!empty($_SERVER[‘HTTPS‘]) && $_SERVER[‘HTTPS‘] !== off || $_SERVER[‘SERVER_PORT‘] == 443) ? "https://" : "http://"; $url = $protocol.$_SERVER[‘HTTP_HOST‘].$_SERVER[‘REQUEST_URI‘]; $api_url="http://api.4vtk.com/wx_js_sdk.php?appid=$appid&appsecret=$appsecret"; $result =file_get_contents($api_url); $jsoninfo = json_decode($result, true); $jsapiTicket=$jsoninfo["jsapiTicket"]; $argu = array(); $argu[‘appId‘] = $appid; $argu[‘url‘] = $url; $argu[‘nonceStr‘] = $this->createNonceStr(); $argu[‘timestamp‘] = time(); $argu[‘jsapi_ticket‘] = $jsapiTicket; $string = "jsapi_ticket=".$argu[jsapi_ticket]."&noncestr=".$argu[nonceStr]."×tamp=".$argu[timestamp]."&url=".$argu[url]; $argu[‘signature‘] = sha1(trim($string)); return $argu; }
标签:
原文地址:http://www.cnblogs.com/yutaoyao/p/4517494.html