modle-sherlock

php微信接口验证写法

<?php
    //获得接口认证
    $timestamp = $_GET[\'timestamp\'];
    $nonce = $_GET[\'nonce\'];
    $token = \'weixin\';
    $signature = $_GET[\'signature\'];
    //将参数字典化排序
    $tmpArr = array($timestamp,$nonce,$token);
    sort($tmpArr);
    $judgeArr = implode(\'\',$tmpArr);
    $judge = sha1($judgeArr);
    //判断是否符合
    if($judge == $signature)
    {
        echo $_GET[\'echostr\'];
        exit;
    }

 

发表于 2016-02-20 13:51  Modle_Sherlock  阅读(1535)  评论(0编辑  收藏  举报
 

分类:

技术点:

相关文章: