首页 > 微信 > 详细

微信公众号接口配置验证URL

时间:2017-05-08 15:52:37      阅读:512      评论:0      收藏:0      [点我收藏+]
/**
     * 审核填写的URL
     */
    public function checkUrl(){
        //获得参数 signature nonce token timestamp echostr

        $nonce     = $_GET(‘nonce‘);
        $token     = ‘sudi‘;
        $timestamp = $_GET(‘timestamp‘);
        $echostr   = $_GET(‘echostr‘);
        $signature = $_GET(‘signature‘);
        //形成数组,然后按字典序排序

        $array = array($nonce, $timestamp, $token);
        sort($array);
        //拼接成字符串,sha1加密 ,然后与signature进行校验
        $str = sha1( implode( $array ) );
        if( $str  == $signature && $echostr ){
            //第一次接入weixin api接口的时候
            echo  $echostr;
            exit;
        }else{
            $this->reponseMsg();
        }

    }

 

微信公众号接口配置验证URL

原文:http://www.cnblogs.com/wqy415/p/6825050.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!