1. PHP 传参总结
1.1 url 传参
解析方法(下面两种解读方式均可以):
$firstName1 = $_GET['firstName'];
$firstName2 = $_REQUEST['firstName'];
传参方法:
<a href="name.php?firstName=Kevin&lastName=Yank"> Hi, I'm Kevin!</a>
1.2 表单传参
解析方法(下面两种解读方式均可以):
$firstName = $_REQUEST['firstName'];
$lastName = $_POST['lastName'];
传参方法:
<form action="name_form.php" method="post">
<div>
<label for="firstName">First Name:
<input type="text" name="firstName" id="firstName">
</label>
</div>
<div>
<label for="lastName">Last Name:
<input type="text" name="lastName" id="lastName">
</label>
</div>
<div>
<input type="submit" value="GO">
</div>
</form>