예제 #1
0
 /**
  * @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();
 }
예제 #2
0
 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}&timestamp={$timestamp}&url={$url}";
     $signature = sha1($string);
     $signPackage = array("appId" => APPID, "nonceStr" => $nonceStr, "timestamp" => $timestamp, "url" => $url, "signature" => $signature, "rawString" => $string);
     return (object) $signPackage;
 }
예제 #3
0
 public function __construct()
 {
     $this->appId = APP_ID;
     $ticket = new JsapiTicket();
     $this->ticket = $ticket->get();
 }