PHP $_REQUEST 是一个内置的超级全局变量,在所有范围内始终可用。 $_REQUEST 是一个关联数组,默认情况下它包含 $_GET、$_POST 和 $_COOKIE。
HTML 表单
考虑下面的示例,其中 test.php 包含以下代码。此页面会将 POST 变量("name"和"age")发送到操作脚本 greetings.php。
<html>
<body>
<form action="greetings.php" method="POST">
Name: <input type = "text" name = "name" />
Age: <input type = "text" name = "age" />
<input type = "submit" />
</form>
</body>
</html>
test.php 看起来类似于:

执行动作脚本
现在,将greetings.php视为包含以下代码的动作脚本页面:
<html>
<body>
<?php
echo "Hello ". $_REQUEST['name']. "<br>";
echo "You are ". $_REQUEST['age']. " years old.";
?>
</body>
</html>
结果
如果向test.php提供以下输入:

当点击"submit"提交按钮时,将会打开greetings.php结果如下:

示例:$_REQUEST示例
下面的示例演示了上述概念。
<html>
<body>
<form action="greetings.php" method="POST">
Name: <input type = "text" name = "name" />
Age: <input type = "text" name = "age" />
<input type = "submit" />
</form>
</body>
</html>