easyWeChat 验证微信 token

<?php
namespace app\index\controller;

use EasyWeChat\Factory;

class Index
{
    public function index()
    {
        $config = [
            'app_id' => 'wx90636672********',
            'secret' => '8c2391e3ccfabee663************',
            'token'   => '****',
            // 指定 API 调用返回结果的类型:array(default)/collection/object/raw/自定义类名
            'response_type' => 'array',

            'log' => [
                'level' => 'debug',
                'file' => __DIR__.'/../../wechat.log',
            ],
        ];

        $app = Factory::officialAccount($config);
        $response = $app->server->serve();
        $response->send(); // Laravel 里请使用:return $response;
    }
}

 

posted @ 2018-07-04 17:14  猿飞侠  阅读(2937)  评论(0编辑  收藏  举报