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) { ... }
そして、いつでもリクエストを渡すだけにフォールバックできます。