index.php:
<?php
// 外部变量
// $_GET[]:
// 接收get方法传输的数据,地址栏传参,不安全且数据量小
echo $_GET['uname'];
// $_POST[]:
// 接收post方法传输的数据,比较安全,并且传输数据量大理论无限制
echo $_POST['age'];
// $_REQUEST:
// get和post都可以接收,还要判断到底用哪个
?>
index.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
</head>
<body>
<a href="index.php?uname=www.hrkkid.com">点击提交</a>
<form action="index.php" method="post">
<input type="text" name="age" id="age" value="请输入年龄" />
<input type="submit" name="提交" />
</form>
</body>
</html>