nodejs的expresss中post的req.body总是undefined的原因

添加进下面的内容即可

var path = require('path');
var bodyParser = require('body-parser');//用于req.body获取值的
app.use(bodyParser.json());
// 创建 application/x-www-form-urlencoded 编码解析
app.use(bodyParser.urlencoded({ extended: false }));

猜你喜欢

转载自www.cnblogs.com/wanghui-garcia/p/10040153.html
今日推荐