如何使用PHP中POST的方法

这篇文章主要介绍如何使用PHP中POST的方法,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!

php有什么特点

1、执行速度快。2、具有很好的开放性和可扩展性。3、PHP支持多种主流与非主流的数据库。4、面向对象编程:PHP提供了类和对象。5、版本更新速度快。6、具有丰富的功能。7、可伸缩性。8、功能全面,包括图形处理、编码与解码、压缩文件处理、xml解析等。

首先我们先写一个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中POST的方法

php验证页面:test.php

<?php

$name=$_POST['username'];
$pass=$_POST['password'];
echo "用户名:".$name."<br>";
echo "密码:".$pass."<br>";

?>
输出:用户名:lilil
      密码:4561212

以上是“如何使用PHP中POST的方法”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注行业资讯频道!