Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Biny中如何将Token添加到请求头Header中? #127

Open
gmplato opened this issue Jan 19, 2021 · 3 comments
Open

Biny中如何将Token添加到请求头Header中? #127

gmplato opened this issue Jan 19, 2021 · 3 comments

Comments

@gmplato
Copy link

gmplato commented Jan 19, 2021

类似这样:

Request Headers
authorization:eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJzc28uY29vbCIsImlhdCI6MTYxMTA1MDY1OSwiZGF0YSI6eyJ1c2VyaWQiOjF9LCJzY29wZXMiOiJyb2xlX2FjY2VzcyIsImV4cCI6MTYxMTA1Nzg1OX0.c8qvPS1lHrk6GuCnU2a4XUnThuzkoowKH2nKCZZE7Vk

现在在做统一登录,登陆后将token放到请求头,老师能给个思路吗?

@gmplato
Copy link
Author

gmplato commented Jan 19, 2021

Biny 的Request Headers 中cookie是通过什么模块写进去的?

@billge1205
Copy link
Collaborator

你是说cookie吗?wiki里有说明 登录态你也可以用session实现 也可以自定义cookie实现
cookie的获取和设置都是在App::$base->request中完成的,分别提供了getCookie和setCookie方法

@billge1205
Copy link
Collaborator

如果是请求带上非cookie的header的话 是需要前端组装请求时带上的
php有原生函数 get_headers 来获取用户提交的header数据
不过登录态的话session或者cookie就足够了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants