我想在模型中编写函数来获取用户 ip,并希望在用户表中存储 Node js 中的列名 ip_address。 (使用 express、mysql)
User.prototype.userip= function(req, res)
{
// here need access to IP address here
}
最佳答案
req.connection.remoteAddress
试试这个
关于node.js - 如何在nodejs模型中获取用户ip?并在我的表格列 ip_address 中更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54360207/