Skip to content

Commit

Permalink
webman服务端验证消息优化 (#2798)
Browse files Browse the repository at this point in the history
webman服务端验证消息添加替换缓存
  • Loading branch information
pengxuxu committed Mar 14, 2024
1 parent fcbe867 commit 9879297
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion docs/src/6.x/official-account/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ namespace app\controller;

use EasyWeChat\OfficialAccount\Application;
use support\Request;
use support\Redis;
use Symfony\Component\Cache\Psr16Cache;
use Symfony\Component\Cache\Adapter\RedisAdapter;
use Symfony\Component\HttpFoundation\HeaderBag;
use Symfony\Component\HttpFoundation\Request as SymfonyRequest;

Expand All @@ -25,7 +28,8 @@ class OfficialAccount
$app = new Application($config);
$symfony_request = new SymfonyRequest($request->get(), $request->post(), [], $request->cookie(), [], [], $request->rawBody());
$symfony_request->headers = new HeaderBag($request->header());
$app->setRequestFromSymfonyRequest($symfony_request);
$app->setRequestFromSymfonyRequest($symfony_request);//必须替换服务端请求
//$app->setCache(new Psr16Cache(new RedisAdapter(Redis::connection()->client())));//根据需要替换缓存,access_token公众号的全局唯一接口调用凭据会使用该缓存存储
$server = $app->getServer();
$response = $server->serve();

Expand Down

0 comments on commit 9879297

Please sign in to comment.