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.
25 lines
629 B
25 lines
629 B
<?php
|
|
/**
|
|
* 微信小程序
|
|
*/
|
|
include_once(SERVER_ROOT . "/model/mBase.php");
|
|
|
|
class mWeixinMp extends mBase {
|
|
public function getOpenid($code) {
|
|
$appid = MP_APPID;
|
|
$secret = MP_SECRET;
|
|
|
|
$get_openid_url = sprintf(MP_GET_OPENID_HREF, $appid, $secret, $code);
|
|
|
|
$jsonres = $this->getCUrl($get_openid_url);
|
|
$get_openid_res = json_decode($jsonres, true);
|
|
if (empty($get_openid_res['openid'])) {
|
|
$this->writeLog('user', 'get_openid_error_log', $get_openid_url . "|" . $jsonres);
|
|
return false;
|
|
}
|
|
|
|
return $get_openid_res['openid'];
|
|
}
|
|
|
|
|
|
}
|
|
|