$ _post ...或....传输数据时直接变量? [英] $_post ...or.... variable direct when transferring data ?

查看:77
本文介绍了$ _post ...或....传输数据时直接变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,



我是PHP的初学者,我非常喜欢它,我每天都会尝试了解它的新内容。

我有一个问题,希望能找到答案。



让我们先来看看下面的简单代码。



首页:first.php

Dears ,

I am a beginner in PHP , i like it so much ,i try everyday to know a new thing about it .
I have a question and I hope to find an answer .

lets first have a look on the below simple code .

first page : first.php

<form method="post" action="second.php">
<input type="text" name="fname">
<input type="text" name="lname">
<input type="submit" value="Go">
</form>



第二页:second.php ----->版本1


second page : second.php -----> version 1

<?php
$firstname=$_post["fname"];
$lastname=$_post["lname"];
echo $fistname.$lastname;
?>



第二页:second.php ----->版本2


second page : second.php -----> version 2

<?php
echo $fname.$lname;
?>



现在,我的问题是

第二页的第1版和第二页的第2版之间的区别是什么?

i尝试它们两者并且它们都没有问题。

所以它们具有相同的含义吗?

换句话说$ _post是强制性的吗?或者我可以忽略它。

谢谢。


Now , my question is :
What is the difference between version 1 of second page and vesion 2 of second page ??
i try both of them and both of them are work with no problem .
so do they have the same meaning ?
in other words Does $_post mandatory ? or i can ignore it .
Thanks .

推荐答案

firstname =
firstname=


_post [ fname];
_post["fname"];


lastname =
lastname=


这篇关于$ _post ...或....传输数据时直接变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆