post和get的不同在于,post请求不会出现在url上面,会将提交的数据放到请求头中
可以在控制台里查看
那么后端如何获取前端提交过来的数据呢
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<form action="get.php" method="post">
<!--会将下面这些数据以get方式提交到get.php的远程服务器中 -->
<input type="text" name="userName"><br>
<input type="password" name="userPwd"><br>
<input type="submit" value="提交"><br>
</form>
</body>
</html>
(文件名我还是用的get.php get.html)
<?php
print_r($_POST);
echo $_POST["userName"];
echo $_POST["userPwd"];