token验证失败(http://1.tinywanweixin.sinaapp.com/index.php/home/Index/index)

来源:2-4 基于ThinkPHP框架的微信API接入

Tinywan

2015-10-26 19:35

<?php

namespace Home\Controller;

use Think\Controller;

class IndexController extends Controller {

    public function index(){

        

        $nonce = $_GET["nonce"];

        $token = "weixin";

        $timestamp = $_GET["timestamp"];

        $echostr = $_GET["echostr"];

        $signature = $_GET["signature"];

        

        $tmpArr = array($nonce, $timestamp, $token);

        sort($tmpArr);

        

        $tmpStr = implode( $tmpArr );

        $tmpStr = sha1( $tmpStr );

        

        if( $tmpStr == $signature )

        {

            echo "Yes It is";

        }else{

            echo "false";

        }

    }

    

    public function show(){

    echo "001212";

    

    }

}


写回答 关注

4回答

  • www_liangmlk_cn
    2015-10-28 08:14:09
    如果相等 必须写成 echo $echostr; 而不是 echo "Yes It is";


  • 博海
    2016-06-01 16:40:23

    我也是 失败

  • 低语忆霖
    2015-12-13 14:56:15

    请问你这

    http://1.tinywanweixin.sinaapp.com/index.php/home/Index/index)

    后面的/home/index/index 是什么意思? index.php不是文件吗 ?文件下怎么会还有东西 ,求助

    Tinywa...

    我的路由没有改掉啊!

    2015-12-13 20:09:55

    共 1 条回复 >

  • Tinywan
    2015-10-28 09:46:36

    换是不行啊!老师

PHP实现微信公众平台开发—提升篇

本课程详细讲解了接收微信用户发送的消息和接收订阅关注的事件推送

64946 学习 · 371 问题

查看课程

相似问题