Credential "component_verify_ticket" does not exist in cache

alipeng

使用开放平台的时候报错,报错信息如下:

Fatal error: Uncaught EasyWeChat\Kernel\Exceptions\RuntimeException: Credential "component_verify_ticket" does not exist in cache. in
  /vendor/overtrue/wechat/src/OpenPlatform/Auth/VerifyTicket.php:69 Stack trace: #0  /vendor/overtrue/wechat/src/OpenPlatform/Auth/AccessToken.php(46): EasyWeChat\OpenPlatform\Auth\VerifyTicket->getTicket() #1  /vendor/overtrue/wechat/src/Kernel/AccessToken.php(220): EasyWeChat\OpenPlatform\Auth\AccessToken->getCredentials() #2  /vendor/overtrue/wechat/src/Kernel/AccessToken.php(107): EasyWeChat\Kernel\AccessToken->getCacheKey() #3  /vendor/overtrue/wechat/src/Kernel/AccessToken.php(235): EasyWeChat\Kernel\AccessToken->getToken() #4  /vendor/overtrue/wechat/src/Kernel/AccessToken.php(192): EasyWeChat\Kernel\AccessToken->getQuery() #5  /vendor/overtrue/wechat/src/Kernel/BaseClient.php(228): EasyWeChat\Kernel\AccessToken->applyToRequest(Object(GuzzleHttp\P in  /vendor/overtrue/wechat/src/OpenPlatform/Auth/VerifyTicket.php on line 69

一、看文档

SDK 默认会处理事件component_verify_ticket,并会缓存verify_ticket所以如果你暂时不需要处理其他事件,直接这样使用即可:

$server = $openPlatform->server;
return $server->serve();

好的,谢谢

二、根据开放平台授权事件接收URL,撰写代码

注:是授权事件接受URL哦,不是消息与事件接收URL

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use EasyWeChat\Factory;
use EasyWeChat\OpenPlatform\Server\Guard;

class TestController extends Controller
{

    protected $openPlatform;

    public function __construct()
    {
        $config = [
            'app_id'   => 'wx7c7a777404377665',
            'secret'   => 'b567f63c204cf4f6e9fa2e8b52f9fcb7',
            'token'    => 'weixin',
            'aes_key'  => 'huishangbao2017soch361ish5g5ubbd63b52bdafi8'
        ];
         $this->openPlatform = Factory::openPlatform($config);
    }

    public function index()
    {
        return $this->openPlatform->server->serve();
    }
}

大佬有没有源码

照着文档写的呀?还是提示: Credential "component_verify_ticket" does not exist in cache

    function getAuthUrl()
    {
        $config = [
            'app_id' => env("WECHAT_OPEN_PLATFORM_APPID"),
            'secret' => env("WECHAT_OPEN_PLATFORM_SECRET"),
            'token' => env("WECHAT_OPEN_PLATFORM_TOKEN"),
            'aes_key' => env("WECHAT_OPEN_PLATFORM_AES_KEY")
        ];
        $openPlatform = Factory::openPlatform($config);
        return $openPlatform->getPreAuthorizationUrl(env('APP_URL')); // 传入回调URI即可
    }

还是提示: Credential "component_verify_ticket" does not exist in cache
照着文档写的

    function getAuthUrl()
    {
        $config = [
            'app_id' => env("WECHAT_OPEN_PLATFORM_APPID"),
            'secret' => env("WECHAT_OPEN_PLATFORM_SECRET"),
            'token' => env("WECHAT_OPEN_PLATFORM_TOKEN"),
            'aes_key' => env("WECHAT_OPEN_PLATFORM_AES_KEY")
        ];
        $openPlatform = Factory::openPlatform($config);
        return $openPlatform->getPreAuthorizationUrl(env('APP_URL')); // 传入回调URI即可
    }

还是提示: Credential "component_verify_ticket" does not exist in cache
照着文档写的

    function getAuthUrl()
    {
        $config = [
            'app_id' => env("WECHAT_OPEN_PLATFORM_APPID"),
            'secret' => env("WECHAT_OPEN_PLATFORM_SECRET"),
            'token' => env("WECHAT_OPEN_PLATFORM_TOKEN"),
            'aes_key' => env("WECHAT_OPEN_PLATFORM_AES_KEY")
        ];
        $openPlatform = Factory::openPlatform($config);
        return $openPlatform->getPreAuthorizationUrl(env('APP_URL')); // 传入回调URI即可
    }

还是提示: Credential "component_verify_ticket" does not exist in cache

    function getAuthUrl()
    {
        $config = [
            'app_id' => env("WECHAT_OPEN_PLATFORM_APPID"),
            'secret' => env("WECHAT_OPEN_PLATFORM_SECRET"),
            'token' => env("WECHAT_OPEN_PLATFORM_TOKEN"),
            'aes_key' => env("WECHAT_OPEN_PLATFORM_AES_KEY")
        ];
        $openPlatform = Factory::openPlatform($config);
        return $openPlatform->getPreAuthorizationUrl(env('APP_URL')); // 传入回调URI即可
    }
    function getAuthUrl()
    {
        $config = [
            'app_id' => env("WECHAT_OPEN_PLATFORM_APPID"),
            'secret' => env("WECHAT_OPEN_PLATFORM_SECRET"),
            'token' => env("WECHAT_OPEN_PLATFORM_TOKEN"),
            'aes_key' => env("WECHAT_OPEN_PLATFORM_AES_KEY")
        ];
        $openPlatform = Factory::openPlatform($config);
        return $openPlatform->getPreAuthorizationUrl(env('APP_URL')); // 传入回调URI即可
    }

没明白如何处理

。。提示我内容不合法 然后我就提交了好几遍。。

这个问题解决了吗