Skip to content

Commit

Permalink
Update client.md fixed #2764
Browse files Browse the repository at this point in the history
  • Loading branch information
overtrue committed Dec 5, 2023
1 parent 9f933f2 commit 24f65bf
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion docs/src/6.x/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,26 @@ $media = $client->withFileContents($contents, 'media', 'filename.png')->post('cg

## 自定义 access_token

自定义 Access Token 需要实现接口 `EasyWeChat\Kernel\Contracts\AccessToken`

```php
class MyAccessToken implements EasyWeChat\Kernel\Contracts\AccessToken
{
public function getToken(): string
{
// 你的逻辑
return 'your token';
}

public function toQuery(): array
{
return ['access_token' => $this->getToken()];
}
}
```

```php
$client->withAccessToken('access_token');
$client->withAccessToken(new MyAccessToken());
$client->get('xxxx');
$client->post('xxxx');
//...
Expand Down

1 comment on commit 24f65bf

@vercel
Copy link

@vercel vercel bot commented on 24f65bf Dec 5, 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-git-6x-overtrue.vercel.app
easywechat.vercel.app
easywechat-overtrue.vercel.app

Please sign in to comment.