/** * @return string */ public function getJsapiTicket() { if ($this->jsapiTicket === null) { $this->jsapiTicket = $jt = new JsapiTicket($this->getAccessToken()); $jt->setLogger($this->getLogger())->setCache($this->isCache())->setApp($this->getApp()); } return $this->jsapiTicket->getTicket(); }
public function getSignPackage() { $jsapi_ticket = new JsapiTicket(); $jsapiTicket = $jsapi_ticket->get(); $url = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"; $timestamp = time(); $nonceStr = $this->createNonceStr(); //rank by ascii $string = "jsapi_ticket={$jsapiTicket}&noncestr={$nonceStr}×tamp={$timestamp}&url={$url}"; $signature = sha1($string); $signPackage = array("appId" => APPID, "nonceStr" => $nonceStr, "timestamp" => $timestamp, "url" => $url, "signature" => $signature, "rawString" => $string); return (object) $signPackage; }
public function __construct() { $this->appId = APP_ID; $ticket = new JsapiTicket(); $this->ticket = $ticket->get(); }