You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
937 B
36 lines
937 B
<?php
|
|
/**
|
|
* 微信开放平台
|
|
*/
|
|
include_once(SERVER_ROOT . "/model/mBase.php");
|
|
|
|
class mWeixinOpen extends mBase {
|
|
|
|
public function getAccessToken($code) {
|
|
$url = sprintf(WEIXIN_OPEN_GET_ACCESS_TOKEN, WEIXIN_OPEN_APPID, WEIXIN_OPEN_APPSCRET, $code);
|
|
$jsonres = $this->getCUrl($url);
|
|
|
|
$res = json_decode($jsonres, true);
|
|
if ($res['errcode']) {
|
|
$this->setError($res['errmsg']);
|
|
return false;
|
|
}
|
|
return $res;
|
|
}
|
|
|
|
public function getUserInfo($access_token, $openid) {
|
|
$url = sprintf(WEIXIN_OPEN_GET_PERSONAL_INFORMATION, $access_token, $openid);
|
|
$jsonres = $this->getCUrl($url);
|
|
|
|
$res = json_decode($jsonres, true);
|
|
if ($res['errcode']) {
|
|
$this->setError($res['errmsg']);
|
|
return false;
|
|
}
|
|
|
|
error_log($res['openid']."\n", 3, "/datacenter/klogin.log", );
|
|
|
|
return $res;
|
|
}
|
|
|
|
}
|
|
|