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.
我以前见过这个问题,但我无法使用这些答案来获取用户的 IP 地址。
在 PHP 中是这样的:
$_SERVER['REMOTE_ADDR'];
如果您需要在操作中访问此信息:
Action { request => val address = request.remoteAddress; ... }
如果您需要在其他地方访问,请注意您可以使用隐式:
Action { implicit request => ... } myMethod(implicit request: Request) { ... }
而且你总是可以退回到只是传递请求。