初始化代码
This commit is contained in:
55
application/api/wxapi/request/AccessTokenRequest.php
Normal file
55
application/api/wxapi/request/AccessTokenRequest.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user