【发布时间】:2020-06-05 04:50:23
【问题描述】:
我有以下非常基本的 PHP 脚本:
<?php
$username = $_POST['username'];
$password = $_POST['password'];
echo "This is the username: ";
echo $username;
?>
这是输出:
This is the username:
我的网址中有我的用户名和密码参数。为什么不回显用户名?
【问题讨论】:
-
也许它们是通过 GET 传递的?当你 ssy 他们在 url 中。使用:$_GET 而不是 $_POST
-
通过 URL 传递的数据在
$_GET数组而不是$_POST中找到。 -
您也可以使用
$_REQUEST访问 URL 和 POST 参数。