SORU
4 AĞUSTOS 2009, Salı


Nasıl istemci IP ve Sunucu IP Raylar kullanarak almak için

Herkes istemci IP almak ve aynı zamanda Rails kullanarak Ruby IP nasıl yardım edebilir?

CEVAP
4 AĞUSTOS 2009, Salı


Denetleyici: sizin

request.remote_ip

Kullanıyorsanız apache önünde bir melez, sonra remote_ip dönecektir kaynak adresi istek, bu durumda olacak yerel ev sahibi, çünkü Apache web server yapma isteği, onun yerine koy Senin bu denetleyici:

@remote_ip = request.env["HTTP_X_FORWARDED_FOR"]

Server IP görmek için:

http://stackoverflow.com/questions/42566/getting-the-hostname-or-ip-in-ruby-on-rails

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • footiecyclo

    footiecyclo

    26 EYLÜL 2009
  • TechnoBuffalo

    TechnoBuffal

    8 HAZİRAN 2007
  • waterfairy17

    waterfairy17

    9 Aralık 2007