PHP设置$ _GET值 [英] php settting $_GET value
本文介绍了PHP设置$ _GET值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要设置$ _GET值;我可以这样做吗?
即我有一个空的$ _GET数组。如何使它与PHP非空?
也许在http头文件的帮助下?
预先感谢您;
解决方案
有三种方法可以做到这一点。
< form method =getaction =file.php>
< input type =textname =TextThing/>
< / form>
在php文件中:
$ _ GET [ TextThing]; //包含texbox TextThing的文本...
第二:
在url后面使用问号,如下所示:
http://domain.com/file.php?foo=bar&stack=overflow
然后:
$ _ GET [foo]; //包含bar
$ _GET [stack]; //包含溢出
请记住,您的用户可以轻松地更改变量的值。
第三:
$ _ GET [foo] =bar;
$ _GET [foo]; //包含bar
I need to set the $_GET values; can I do this?
ie I have an empty $_GET array. How can make it nonempty with php?
Maybe with help of http headers?
Thank you in advance;
解决方案
It is three ways of doing this.
One:
<form method="get" action="file.php">
<input type="text" name="TextThing" />
</form>
In the php file:
$_GET["TextThing"]; //contains the text of the texbox TextThing...
Second:
Use a questionmark behind the url, like this: http://domain.com/file.php?foo=bar&stack=overflow
Then:
$_GET["foo"]; //contains bar
$_GET["stack"]; //contains overflow
Remember that your users easily can change the values of the variables.
Third:
$_GET["foo"] = "bar";
$_GET["foo"]; //contains bar
这篇关于PHP设置$ _GET值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文