router.post('/signin', function(req, res) {
var username = req.body.username;
var password = req.body.password;
if(username&&password) {
pool.getConnection(function(err, connection) {
connection.query('select password from users where username="'+username+'"', function (err, result) {
if(err){
throw err;
} else {
if(result[0] === undefined) {
res.send('没有该用户。');
} else {
console.log(result[0].password === req.body.password);//false
console.log(result[0].password);//123456
console.log(req.body.password);//123456
}
}
})
})
}
});
这个地方是为什么?
console.log(result[0].password === req.body.password);//false
猛跑小猪
相关分类