您好,欢迎访问一九零五行业门户网

掌握正确使用PHP中POST的方法

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的方法的详细内容。
其它类似信息

推荐信息