示例
👏🏻 欢迎点击本页下方 "帮助我们改善此页面!" 链接参与贡献更多的使用示例!
webman 服务端验证消息
php
<?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());
}
}