node.js3-get

const http = require("http")
const _url = require("url")
http.createServer((req,res)=>{
	//console.log(req.url) //  /a?name=1&password=123
	let urlQuery = _url.parse(req.url,true)
	console.log(urlQuery.query)//{ name: 'johnson', password: '233' }
}).listen(3301)
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<form action="http://localhost:3301/a" method="get">
			name:<input type="text" name="name"><br>
			password:<input type="password" name="password"><br>
			<input type="submit" value="提交">
			
		</form>
	</body>
</html>

猜你喜欢

转载自blog.csdn.net/xiaohanzhu000/article/details/87874876