飞鱼博客» get和post在php中的使用方法

get和post是网页设计中对表单的两种处理方法,但我总是会将两者搞混了。我将其简要记录一下,我只会用php语言的。

主文件中form部分:

<form action="test.php" method="get">
	<input name="name1" type="text" />
	<input name="name2" type="text" />
</form>

<form action="test.php" method="post">
	<input name="name3" type="text" />
</form>

<form action="test.php?a=5&b=6" method="post">
	<input name="name4" type="text" />
</form>

在test.php中调用方法:

$str1 = $_GET['name1'];
$str2 = $_GET['name2'];
$str3 = $_POST['name3'];
$str4 = $_POST['name4'];
$str5 = $_GET['a'];
$str6 = $_GET['b'];

【假如您觉得这篇文章对您有帮助,请评一下分吧!】
1 星2 星3 星4 星5 星 (至今还没有人评分,您愿意{dy}个来评价吗?)

郑重声明:资讯 【飞鱼博客» get和post在php中的使用方法】由 发布,版权归原作者及其所在单位,其原创性以及文中陈述文字和内容未经(企业库qiyeku.com)证实,请读者仅作参考,并请自行核实相关内容。若本文有侵犯到您的版权, 请你提供相关证明及申请并与我们联系(qiyeku # qq.com)或【在线投诉】,我们审核后将会尽快处理。
—— 相关资讯 ——