超全局变量数组的概念不同于全局变量,这里我主要说的是用来接收信息用的。其实在以往已经大量使用了
首先:get数组,速度较好,但是相对不是很安全。
post数组,可以接收大的数据量,较安全,最常用。
request数组,可以接收get和post的数据,但是最不建议,不安全。
resver数组,这是现实客户端信息用的,并不用来接收数据。
下面是代码实例:
<html> <head> <title>测试</title> <meta charset="utf-8"/> </head> <body> <form action="process_get.php" method="POST"><br/> 用户名:<input type="text" name="name"><br/> 密码:<input type="password" name="password"><br/> <input type="radio" name="city" value="beijing">北京<br/> <input type="radio" name="city" value="shanghai">上海<br/> <input type="radio" name="city" value="guangzhou">广州<br/> <input type="file" name="myfile" value="上传文件"><br/> <textarea name="hobby"></textarea> <input type="submit" value="提交用户数据"> </form> </body> </html>
<?php
$name=$_POST['name'];
$password=$_POST['password'];
$city=$_POST['city'];
$hobby=$_POST['hobby'];
echo "账户信息:<br/>";
echo "姓名:".$name."<br/>";
echo "密码:".$password.'<br/>';
//echo "所在地:".$city.'<br/>';
echo "爱好:".$hobby."<br/>";
if(empty($_POST['city'])){
echo "没有收到城市信息";
}else{
echo "所在地:".$city.'<br/>';
}
//header("Location: http://www.baidu.com");
?>
超全局变量数组get post requerst resver的使用规则
原文地址:http://blog.csdn.net/mycodedream/article/details/44221813