[PHP]代码
<?php /***************************/ /* Wechat 登录 / /* by tiandi 2014.12.6 / /***************************/ if (defined('WEBSITE') || defined('GETINFO')) { global $_LANG; $_LANG['help']['APP_KEY'] = '在微信开发者平台申请的AppID'; $_LANG['help']['APP_SECRET'] = '在微信开发者平台申请的AppSecret'; $_LANG['APP_KEY'] = 'AppID'; $_LANG['APP_SECRET'] = 'AppSecret'; $i = isset($web) ? count($web) : 0; // 类名 $web[$i]['name'] = 'wechat'; // 文件名,不包含后缀 $web[$i]['type'] = 'wechat'; $web[$i]['className'] = 'wechat'; // 作者信息 $web[$i]['author'] = 'tiandi'; // 作者QQ $web[$i]['qq'] = ''; // 作者邮箱 $web[$i]['email'] = ''; // 申请网址 $web[$i]['website'] = 'http://open.weixin.qq.com'; // 版本号 $web[$i]['version'] = '1.0'; // 更新日期 $web[$i]['date'] = '2014-12-6'; // 配置信息 $web[$i]['config'] = array( array('type'=>'text' , 'name'=>'APP_KEY', 'value'=>''), array('type'=>'text' , 'name' => 'APP_SECRET' , 'value' => ''), ); } if (!defined('WEBSITE')) { include_once(dirname(__FILE__).'/oath2.class.php'); class website extends oath2 { function website() { $this->app_key = APP_KEY; $this->app_secret = APP_SECRET; $this->scope = 'snsapi_login'; //by tiandi authorizeURL是用来PHP打开微信登录时用,JS调用则不用authorizeURL。 $this->authorizeURL = 'https://open.weixin.qq.com/connect/qrconnect'; $this->tokenURL = 'https://api.weixin.qq.com/sns/oauth2/access_token'; $this->refreshtokenURL = 'https://api.weixin.qq.com/sns/oauth2/refresh_token'; $this->userURL = 'https://api.weixin.qq.com/sns/userinfo'; $this->meth = 'GET'; } function Code2Token($code) { $params = 'appid='.$this->app_key.'&secret='.$this->app_secret.'&code='.$code. '&grant_type=authorization_code'; $tokenurl = $this->tokenURL."?". $params; $token = $this->http($tokenurl, 'GET'); $token = json_decode($token , true); return $token; } function GetRefreshToken($token) { $params = 'appid='.$this->app_key.'&grant_type=refresh_token&refresh_token='.$token; $tokenurl = $this->refreshtokenURL."?". $params; $token = $this->http($tokenurl, 'GET'); $token = json_decode($token , true); return $token; } function Getinfo($token,$openid) { $params = 'access_token='.$token.'&openid='.$openid; $userurl = $this->userURL."?". $params; $userinfo = $this->http($userurl, 'GET'); return json_decode($userinfo , true); } } }
성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.

핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

AI Hentai Generator
AI Hentai를 무료로 생성하십시오.

인기 기사
R.E.P.O. 에너지 결정과 그들이하는 일 (노란색 크리스탈)
1 몇 달 전By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. 최고의 그래픽 설정
1 몇 달 전By尊渡假赌尊渡假赌尊渡假赌
어 ass 신 크리드 그림자 : 조개 수수께끼 솔루션
3 몇 주 전ByDDD
Windows 11 KB5054979의 새로운 기능 및 업데이트 문제를 해결하는 방법
2 몇 주 전ByDDD
Will R.E.P.O. 크로스 플레이가 있습니까?
1 몇 달 전By尊渡假赌尊渡假赌尊渡假赌

뜨거운 도구

MinGW - Windows용 미니멀리스트 GNU
이 프로젝트는 osdn.net/projects/mingw로 마이그레이션되는 중입니다. 계속해서 그곳에서 우리를 팔로우할 수 있습니다. MinGW: GCC(GNU Compiler Collection)의 기본 Windows 포트로, 기본 Windows 애플리케이션을 구축하기 위한 무료 배포 가능 가져오기 라이브러리 및 헤더 파일로 C99 기능을 지원하는 MSVC 런타임에 대한 확장이 포함되어 있습니다. 모든 MinGW 소프트웨어는 64비트 Windows 플랫폼에서 실행될 수 있습니다.

드림위버 CS6
시각적 웹 개발 도구

WebStorm Mac 버전
유용한 JavaScript 개발 도구

ZendStudio 13.5.1 맥
강력한 PHP 통합 개발 환경

메모장++7.3.1
사용하기 쉬운 무료 코드 편집기
