在 PHP 中,可以使用 $_POST
变量来获取 POST 请求中的数据。
假设有一个表单提交数据到 submit.php
文件:
<form method="post" action="submit.php">
<input type="text" name="username">
<input type="password" name="password">
<input type="submit" value="提交">
</form>
在 submit.php
文件中,可以使用 $_POST
来获取表单提交的数据:
$username = $_POST['username'];
$password = $_POST['password'];
echo "Username: " . $username;
echo "Password: " . $password;
这样就可以获取到 POST 请求中的数据,并进行相应的处理或存储。请注意,需要注意对用户输入的数据进行验证和过滤,以防止安全问题。
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
相关推荐:php怎么获取post数据的字节