56 lines
1.1 KiB
PHP
56 lines
1.1 KiB
PHP
|
|
<?php
|
||
|
|
namespace app\api\wxapi\request;
|
||
|
|
|
||
|
|
use app\api\wxapi\Base;
|
||
|
|
/* 获取常规access_token
|
||
|
|
* $AccessTokenRequest=new AccessTokenRequest();
|
||
|
|
* $AccessTokenRequest->setAppId($WxClient->appID);
|
||
|
|
* $AccessTokenRequest->setSecret($WxClient->appsecret);
|
||
|
|
* $AccessTokenRequest=$WxClient->execute($AccessTokenRequest);
|
||
|
|
* */
|
||
|
|
class AccessTokenRequest extends Base
|
||
|
|
{
|
||
|
|
private $apiParas = array();
|
||
|
|
private $appid;
|
||
|
|
private $secret;
|
||
|
|
private $code;
|
||
|
|
|
||
|
|
public function init(){
|
||
|
|
$this->apiParas['grant_type'] = 'client_credential';
|
||
|
|
$this->setAppId('');
|
||
|
|
$this->setSecret('');
|
||
|
|
}
|
||
|
|
|
||
|
|
public function getApiMethodName(){
|
||
|
|
return "cgi-bin/token";
|
||
|
|
}
|
||
|
|
|
||
|
|
public function getApiParas(){
|
||
|
|
return $this->apiParas;
|
||
|
|
}
|
||
|
|
|
||
|
|
public function putOtherTextParam($key, $value){
|
||
|
|
$this->apiParas[$key] = $value;
|
||
|
|
$this->$key = $value;
|
||
|
|
}
|
||
|
|
|
||
|
|
public function setAppId($appid){
|
||
|
|
$this->appid = $appid;
|
||
|
|
$this->apiParas["appid"] = $appid;
|
||
|
|
}
|
||
|
|
|
||
|
|
public function getAppId(){
|
||
|
|
return $this->appid;
|
||
|
|
}
|
||
|
|
|
||
|
|
public function setSecret($secret){
|
||
|
|
$this->secret = $secret;
|
||
|
|
$this->apiParas["secret"] = $secret;
|
||
|
|
}
|
||
|
|
|
||
|
|
public function getSecret(){
|
||
|
|
return $this->secret;
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|