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.
可能重复: 如何在 PlayFramework2 中获取用户的 IP?
我有一个播放框架应用程序,用户在其中输入表单提交它,并routes已设置为通过index.scala.html文件显示帖子。
routes
index.scala.html
如何获取用户的 IP 地址?我想用他的位置标记那个帖子。
在控制器中:
request.remoteAddress;
在控制器之外:
Http.Request.current.get().remoteAddress;