为什么我在JavaScript中使用了EL语法,但不显示呢?(已经设置了webstorm能识别ELS6语法的了)
我的JS代码如下:
const http=require('http');
const query=require('querystring');
http.createServer(function (req, res) {
var str=' ';//接受数据
var i=0;
req.on('data',function (data) {//有一段数据到达就发送一次
console.log('第${i++}次收到数据');
str+=data;
});
req.on('end',function () {//全部到达,只发一次
var post=query.parse(str);
console.log(post);
});
}).listen(8080);
HTML代码如下:<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Form</title>
</head>
<body>
<form action="http://localhost:8080" method="post">
<input type="text" name="user" value=""><br>
<input type="password" name="pass" value="" ><br>
<textarea name="content" rows="8" cols="40"></textarea>
<input type="submit" value="提交">
</body>
</html>
显示结果如下:
${i++}次收到数据
{ ' user': '234', pass: '234', content: '' }
es6模板字符串 是`` tab键上边那个 不是单引号