|
użytkowników online: 49
|
OPINIE UŻYTKOWNIKÓW
|
Mimo, że strony WWW tworzymy już 5 lat zawsze znajdziemy coś ciekawego. Świadczy o tym chociażby nasza aktówka, w której znajduje się kilkadziesiąt porad, z których często korzystamy. Otwarta forma poradnika, czyli możliwość podrzucania tematów oraz wspólny ich rozwój, to nieoceniona pomoc. Uważam, ze abonament roczny jest niewspółmiernie niski do jakości zaprezentowanych materiałów.
Marek Kończal
Internetix.pl
|
|
PODRĘCZNIK PHP 5.x, 4.x, 3.x - częściowo spolszczony / źródło: www.php.net
[Spis]
[A]
[B]
[C]
[D]
[E]
[F]
[G]
[H]
[I]
[J]
[K]
[L]
[M]
[N]
[O]
[P]
[Q]
[R]
[S]
[T]
[U]
[V]
[X]
[W]
[Z]
session_is_registered (PHP 4, PHP 5) session_is_registered --
Sprawdź czy globalna zmienna jest zarejestrowana w sesji
Opisbool session_is_registered ( string nazwa )
session_is_registered() zwraca wartość TRUE jeśli w
bieżącej sesji zarejestrowana jest globalna zmienna o nazwie
nazwa.
Notatka:
Jeśli użyta została tablica $_SESSION (lub
$HTTP_SESSION_VARS dla PHP 4.0.6 lub starszych), do
sprawdzenia czy zmienna została zarejestrowana w sesji należy użyć
funkcji isset() na tablicy
$_SESSION.
User Contributed Notessteve at fakesterdesigns com
29-Jun-2004 05:21
since it seems a little tedious to use $_SESSION['var'] all over my code, I just make a reference at the start of my page and use the simple reference name thereafter.
<?
session_start();
$myName = &$_SESSION['myName'];
echo($myName);
?>
This is, of course, only a reference and not a copy. So if you change the local variable, It'll be changed in the $_SESSION global array as well. This could be good or bad, so just be aware of what you're doing.
Tuukka from Finland
17-Jun-2004 09:16
From the previous note:
--------------------------------------------------
So, forget session_register(), session_unregister(), session_destroy() and al those stupid functions. The only thing you need is the super global $_SESSION.
--------------------------------------------------
I do have to disagree about the session_destroy() function; if you want to remove the session file created in the server tmp or whatever folder, you must use session_destroy() function.
The <?php $_SESSION = array(); ?> code only unsets the superglobal variables.
For clearing the superglobals, the cookie and deleting the server session file, my advice would be using the code below.
<?php
setcookie(session_name() ,"",0,"/");
unset($_COOKIE[session_name()]);
$_SESSION = array();
session_unset();
session_destroy();
?>
webmaster __AT__ digitalanime __DOT__ nl
22-Feb-2004 11:47
Do not use this anymore!
As of PHP 4.* the super globals are used, so you have to FORGET this function. Super globals are way more safe and they are exactly what they have to be: Clear.
$_POST says that variables in that array come from a form.
$_GET says that variables are passed through the URI.
$_SESSION says (more than clear) that variables are in a session.
USE THEM! They are not there because of their beauty or something..
So, forget session_register(), session_unregister(), session_destroy() and al those stupid functions. The only thing you need is the super global $_SESSION.
somedude at wholikesphp dot com
31-Oct-2002 07:02
Just to elaborate for those who may be having some problems.
If you're using a newer version of PHP that comes with the register globals directive set to "off", you should heed the caution at the top of these notes. It's easier anyway.
Instead of using session_register(...) , simply use somethig like:
<?
session_start();
$_SESSION['VARNAME'] = $something session_start();
if(isset($_SESSION['VARNAME']))
{
print("What you want if the session var is set");
}
else
{
print("What you want if the sessions variable is not set");
}
?>
I hope this helps someone! If you want to learn more about $_SESSION and/or it's related "superglobals" try
http://www.php.net/manual/en/printwn/language.variables.predefined.php
good road!
miguel dot simoes at swirve dot com
13-Jun-2002 01:27
When using PHP 4.2.0 even on the same page where you registered the variable with:
session_register("someVar");
if you try to see if the variable is set and do not assign it a value before, the function used in the previous comment will give the same output.
This may show that the variable is declared and will not be set until some value is give assign to it.
I think that this way will give the option to register all the variables used for sure on the process on the first page and using them as the time comes.
|