Skip to content

Commit

Permalink
Update examples.md (#2670)
Browse files Browse the repository at this point in the history
  • Loading branch information
uax committed Mar 17, 2023
1 parent 515c09e commit f0d5294
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions docs/src/6.x/official-account/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,38 @@

> 👏🏻 欢迎点击本页下方 "帮助我们改善此页面!" 链接参与贡献更多的使用示例!
<details>
<summary>webman 服务端验证消息</summary>

```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://yourdomain.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());
}
}
```
</details>

<!--
<details>
Expand Down

1 comment on commit f0d5294

@vercel
Copy link

@vercel vercel bot commented on f0d5294 Mar 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

easywechat – ./

easywechat.vercel.app
easywechat-git-6x-overtrue.vercel.app
easywechat-overtrue.vercel.app

Please sign in to comment.