作者 郭文星

123

... ... @@ -24,18 +24,18 @@ class Login extends Base
{
$appid = $this->AppID;
$AppSecret = $this->AppSecret;
$post = $this->request->param();
$code = $post['code'];// I('post.code');
$encryptedData = $post['encryptedData'];//I('post.encryptedData');
$iv = $post['iv'];//I('post.iv');
if ($post['type'] == 1) {
$encryptedData = urldecode($encryptedData);
$iv = urldecode($iv);
file_put_contents("ccc.txt", "授权A:" . date("Y-m-d H:i:s") . ":" . $encryptedData . PHP_EOL, FILE_APPEND);
// file_put_contents("ccc.txt", "授权B:" . date("Y-m-d H:i:s") . ":" . $iv . PHP_EOL, FILE_APPEND);
}
$code = $this->request->param("code");
// $encryptedData = $this->request->param("encryptedData");
// $iv = $this->request->param("iv");
// $type = $this->request->param("type");
//
// if ($type == 1) {
// $encryptedData = urldecode($encryptedData);
// $iv = urldecode($iv);
// file_put_contents("ccc.txt", "授权A:" . date("Y-m-d H:i:s") . ":" . $encryptedData . PHP_EOL, FILE_APPEND);
//// file_put_contents("ccc.txt", "授权B:" . date("Y-m-d H:i:s") . ":" . $iv . PHP_EOL, FILE_APPEND);
//
// }
$url = "https://api.weixin.qq.com/sns/jscode2session?appid=" . $appid . "&secret=" . $AppSecret . "&js_code=" . $code . "&grant_type=authorization_code";
$res = json_decode(http_request($url), true);
... ...