学习php微信开发应用接入API接口笔记
2016-11-23 19:36
841 查看
课程地址:http://www.imooc.com/learn/483
1、打开自已的微信公众平台·:https://mp.weixin.qq.com
2、点击左边底部的基本配置:
3、修改配置
4、填写基本配置
URL:我们可以访问的公共地址
token:我们可以任意写(token是什么,在这里就不唠叨了)
EncodingAESKey:点击随机生成
最后点击提交(这时我们提交会失败)why?
我们要配置weixin.php
配置代码:
<?php
//获得参数 signature nonce token timestamp echostr
$nonce = $_GET['nonce'];
$token = 'weixin';
$timestamp = $_GET['timestamp'];
$echostr = $_GET['echostr'];
$signature = $_GET['signature'];
//形成数组,然后按字典序排序
$array = array();
$array = array($nonce, $timestamp, $token);
sort($array);
//拼接成字符串,sha1加密 ,然后与signature进行校验
$str = sha1( implode( $array ) );
if( $str == $signature && $echostr ){
//第一次接入weixin api接口的时候
echo $echostr;
exit;
}
记得把写好的weixin.php文件上传到服务器喔~
5.最后在基本配置页面的服务器配置要启动
这时返回步骤四,重新提交,这时就会token验证成功
返回到基本配置页面时出现:
1、打开自已的微信公众平台·:https://mp.weixin.qq.com
2、点击左边底部的基本配置:
3、修改配置
4、填写基本配置
URL:我们可以访问的公共地址
token:我们可以任意写(token是什么,在这里就不唠叨了)
EncodingAESKey:点击随机生成
最后点击提交(这时我们提交会失败)why?
我们要配置weixin.php
配置代码:
<?php
//获得参数 signature nonce token timestamp echostr
$nonce = $_GET['nonce'];
$token = 'weixin';
$timestamp = $_GET['timestamp'];
$echostr = $_GET['echostr'];
$signature = $_GET['signature'];
//形成数组,然后按字典序排序
$array = array();
$array = array($nonce, $timestamp, $token);
sort($array);
//拼接成字符串,sha1加密 ,然后与signature进行校验
$str = sha1( implode( $array ) );
if( $str == $signature && $echostr ){
//第一次接入weixin api接口的时候
echo $echostr;
exit;
}
记得把写好的weixin.php文件上传到服务器喔~
5.最后在基本配置页面的服务器配置要启动
这时返回步骤四,重新提交,这时就会token验证成功
返回到基本配置页面时出现:
相关文章推荐
- PHP 开发 APP 接口 学习笔记与总结 - XML 方式封装通信接口
- PHP 开发 APP 接口学习笔记与总结 - [ Linux ] 定时任务
- PHP 开发 APP 接口 学习笔记与总结 - APP 接口实例 [5] 版本设计分析及数据表设计
- PHP 开发 APP 接口 学习笔记与总结 - APP 接口实例 [4] 首页 APP 接口开发方案 ③ 定时读取缓存方式
- Spring Cloud 学习笔记-搭建微信h5牛牛棋牌房卡平台开发应用
- 【Android 应用开发】Android 网络编程 API笔记 - java.net 包相关 接口 api
- PHP学习笔记(一):开发微信平台
- 适合新手学习的laravel接入微信接口,实现微信公众号二次开发
- C#开发微信门户及应用(32)--微信支付接入和API封装使用
- C#开发微信门户及应用(32)--微信支付接入和API封装使用
- PHP微信公众平台开发:配置、微信api接入验证
- PHP 开发 APP 接口 学习笔记与总结 - JSON 方式封装通信接口
- php学习笔记---面向对象中[接口]与[多态性]的应用
- php学习笔记---面向对象中[接口]与[多态性]的应用
- php学习笔记---面向对象中[接口]与[多态性]的应用
- PHP 开发 APP 接口 学习笔记与总结 - Redis 缓存
- PHP 开发 APP 接口 学习笔记与总结 - JSON 结合 XML 方式封装通信接口
- PHP 开发 APP 接口 学习笔记与总结 - APP 接口实例 [2] 首页 APP 接口开发方案 ① 读取数据库方式
- 微信学习开发笔记:一、微信的接入
- php学习笔记 面向对象中[接口]与[多态性]的应用