Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法id在不访问数据库的情况下获取当前登录用户的身份?
id
如果您id通过调用获取用户的current_user.id,它会创建一个数据库查询并从那里获取它。
current_user.id
You can use session["warden.user.user.key"][1][0] to get current user id from session
session["warden.user.user.key"][1][0]