PHP 经常性地使用信息传输,这也是 PHP 为实现动态网页应运而生地缘由,对于信息量极少的,我们可能会使用 GET ,但是数据内容较多时我们会使用 POST ,本文就带大家一起来看一看。
首先我们先写一个html页面:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<form action="test.php" method="POST">
<label for="username">账号:</label>
<input type="text" id="username" name="username">
<label for="password">密码:</label>
<input type="text" id="password" name="password">
<input type="submit" value="提交">
</form>
</body>
</html>
php验证页面:test.php
<?php $name=$_POST['username']; $pass=$_POST['password']; echo "用户名:".$name."<br>"; echo "密码:".$pass."<br>"; ?>
输出:用户名:lilil 密码:4561212
推荐: 《 2021年PHP面试题大汇总(收藏) 》《 php视频教程 》
以上就是掌握正确使用PHP中POST的方法的详细内容!
查看更多关于掌握正确使用PHP中POST的方法的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://www.haodehen.cn/did52013