久久国产成人av_抖音国产毛片_a片网站免费观看_A片无码播放手机在线观看,色五月在线观看,亚洲精品m在线观看,女人自慰的免费网址,悠悠在线观看精品视频,一级日本片免费的,亚洲精品久,国产精品成人久久久久久久

分享

PHP實(shí)現(xiàn)支付寶登錄

 軟件開(kāi)發(fā)組 2020-07-01

復(fù)制代碼

1.支付寶路由拼接
    public function dev()

{

$http = 'https://openauth./oauth2/publicAppAuthorize.htm?';

$app_id = '';

$scope = 'auth_user';

$redirect_uri = urlencode('');

$state = '0';

$url = $http . 'app_id=' . $app_id . '&scope=' . $scope . '&redirect_uri=' . $redirect_uri . '&state=' . $state; $this->redirect($url);

}

}

復(fù)制代碼

2.支付寶的回調(diào)頁(yè)面

復(fù)制代碼

public function zhi()

{

$params = input();

require_once './plugins/auth/AopSdk.php';

$aop = new \AopClient ();

$aop->gatewayUrl = 'https://openapi./gateway.do';

$aop->appId = '2016100200645172';

$aop->rsaPrivateKey = '私鑰';

$aop->alipayrsaPublicKey = '公鑰';

$aop->apiVersion = '1.0';

$aop->signType = 'RSA2';

$aop->postCharset = 'UTF-8';

$aop->format = 'json';

$request = new \AlipaySystemOauthTokenRequest ();

$request->setGrantType("authorization_code"); $request->setCode($params['auth_code']);

$result = $aop->execute($request); $result = (new \think\Collection($result))->toArray();

$access_token = $result['alipay_system_oauth_token_response']->access_token ?? ''; if (!$access_token) {

echo json_encode(['msg' => 'code無(wú)效'], JSON_UNESCAPED_UNICODE); }

}

$request = new \AlipayUserInfoShareRequest ();

$result = $aop->execute($request, $access_token); \app\home\logic\Auto

\app\home\logic\Auto::ali($result);

$list = \app\common\model\User::where('open_type',

'alipay')->where('openid', $result->alipay_user_info_share_response->user_id)->find();

session(

session('user_info', $list->toArray());

$blank_url = session('blank_url') ?: 'home/index/index'; \app\home\logic\CartLogic

\app\home\logic\CartLogic::cookieToDb();

$this->redirect($blank_url); }

}

復(fù)制代碼

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,,所有內(nèi)容均由用戶(hù)發(fā)布,不代表本站觀點(diǎn),。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式,、誘導(dǎo)購(gòu)買(mǎi)等信息,謹(jǐn)防詐騙,。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶(hù) 評(píng)論公約

    類(lèi)似文章 更多