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 (request.remote_ip)。我怎样才能得到电脑的名字?
es 有很多解决方案
1) require 'socket' Socket.gethostname
require 'socket'
Socket.gethostname
2) system("hostname")
system("hostname")
3)如果你想得到请求主机然后request.host
request.host
如果你想要远程主机名
4)require 'resolv' Resolv.getname(request.remote_ip)
require 'resolv'
Resolv.getname(request.remote_ip)
谢谢