好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

Rails获取客户端IP地址

Rails获取客户端IP地址

Example Rails Code

In RAILS_ROOT/app/controllers/show_my_ip_controller.rb :

view plain copy to clipboard print ?

class ShowMyIpController < ApplicationController         def index        @client_ip = request.remote_ip      end       end   

In RAILS_ROOT/app/views/show_my_ip/index.html.erb :

Your IP address is < %= @client_ip % >  



查看更多关于Rails获取客户端IP地址的详细内容...

  阅读:36次