thinkphp开发微信,为什么老是配置失败呢?

浏览:584 发布日期:2017/08/20 分类:求助交流
<?php
namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller {
    public function index(){
        //echo "1112";
        //获得参数signature,nonce,token,timestamp,echostr
        $nonce = $_GET['nonce'];
        $token = 'xiaojia';
        $timestamp = $_GET['timestamp'];
        $echostr   = $_GET['echostr'];
        $signature = $_GET['signature'];
        //形成数组,然后按字典序排序
        $array = array();
        $array = array($timestamp,$nonce,$token);        
        sort($arr);
        //拼接成字符串,然后与signature进行校验
        $str = sha1(implode($array));
        if($str == $signature){
            echo $str;
            exit;
        }
    }
    
    
}
最佳答案
评论( 相关
后面还有条评论,点击查看>>