Webman 使用 easywechat 6.x 配置公众平台token验证失败 #2744
-
使用官方文档提供的代码,token验证失败,配置也是对的,求大佬帮忙 <?php
namespace app\controller;
use EasyWeChat\OfficialAccount\Application;
use support\Request;
use Symfony\Component\HttpFoundation\HeaderBag;
use Symfony\Component\HttpFoundation\Request as SymfonyRequest;
// 授权事件回调地址:http://easywechat.com/OfficialAccount/server
class OfficialAccount
{
public function server(Request $request)
{
$config = config('wechatv6.official_account');
$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);
$server = $app->getServer();
$response = $server->serve();
return response($response->getBody());
}
} |
Beta Was this translation helpful? Give feedback.
Answered by
qianshi-tech
Sep 11, 2023
Replies: 2 comments
-
var_dump($response->getBody());
return response($response->getBody()); 返回值: object(Nyholm\Psr7\Stream)#96 (6) {
["stream":"Nyholm\Psr7\Stream":private]=>
resource(402) of type (stream)
["seekable":"Nyholm\Psr7\Stream":private]=>
bool(true)
["readable":"Nyholm\Psr7\Stream":private]=>
bool(true)
["writable":"Nyholm\Psr7\Stream":private]=>
bool(true)
["uri":"Nyholm\Psr7\Stream":private]=>
NULL
["size":"Nyholm\Psr7\Stream":private]=>
NULL
} |
Beta Was this translation helpful? Give feedback.
0 replies
-
已经解决了, 封装后没有return导致的。 |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
qianshi-tech
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
已经解决了, 封装后没有return导致的。