appid=$appid; $this->secret=$secret; } public function get(){ $url="https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=".$this->appid."&secret=".$this->secret; $http= wx_http::factory($url,wx_http::TYPE_CURL); $json= $http->get(); $result=json_decode($json,true); if(isset($result['errcode'])){ $this->_errorno=$result['errcode']; $this->_error=$result['errmsg']; return false; } if(isset($result['access_token'])){ return $result; } } public function getErrno() { return $this->_errno; } public function getError() { return $this->_error; } }