Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> $z, $_GET["z"], $HTTP_GET_VARS["z"]
__phpion__
post
Post #1





Grupa: Zablokowani
Postów: 50
Pomógł: 0
Dołączył: 8.08.2004

Ostrzeżenie: (10%)
X----


Intryguje mnie jedno. Dlaczego spora wiekszosc programistow uzywa $_GET["zmienna"] skoro zadziala to tylko przy wylaczonych registerach_globalach. Czy nie lepiej uzywac $HTTP_GET_VARS["zmienna"]??? Wiem, ze to troche dluzszy zapis ale zadziala przy registerach_globalach zarowno on jak i off. Dlaczego wiec wiekszosc upiera sie za samym $_GET?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
rogrog
post
Post #2





Grupa: Zarejestrowani
Postów: 602
Pomógł: 1
Dołączył: 3.04.2004
Skąd: Trójmiasto (Gdańsk)

Ostrzeżenie: (0%)
-----


Cytat(__phpion__ @ 2004-09-23 12:50:16)
$_GET["zmienna"] zadziala to tylko przy wylaczonych registerach_globalach.

$HTTP_GET_VARS["zmienna"] zadziala przy registerach_globalach zarowno on jak i off.

no nie do końca tak jak myślisz

$_GET działa zarówno przy register_globals on jak i off. zostało wprowadzone w php 4.1.0 . We wcześniejszych wersjach php jego odpowiednikiem było $HTTP_GET_VARS, które teraz jest przestarzałe.

$_GET różni się od $HTTP_GET_VARS tym, że jest zmienną superglobalną (dostępne również w funkcjach i metodach bez konieczności global )

register_globals extractuje zmienne z $_GET, ale nie wyłącza dostępności tej tablicy!


na koniec cytat z manuala
Cytat(manual)
HTTP GET variables: $_GET

Notatka: Introduced in 4.1.0. In earlier versions, use $HTTP_GET_VARS.

An associative array of variables passed to the current script via the HTTP GET method. Automatically global in any scope.

This is a 'superglobal', or automatic global, variable. This simply means that it is available in all scopes throughout a script. You don't need to do a global $_GET; to access it within functions or methods, as you do with $HTTP_GET_VARS.

$HTTP_GET_VARS contains the same initial information, but is not an autoglobal. (Note that HTTP_GET_VARS and $_GET are different variables and that php handles them as such)

If the register_globals directive is set, then these variables will also be made available in the global scope of the script; i.e., separate from the $_GET and $HTTP_GET_VARS arrays. For related information, see the security chapter titled Using Register Globals. These individual globals are not autoglobals.
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 17.10.2025 - 02:49