what's up everybody this is quivered taking and this we're
going to learn
about beach the sessions what our peach piece sessions well
it's a way to
information across multiple pages and in phd to this
information in sessions
is stored inside variable named on their score session it's
a global
variable so by cookies where the information has stored on
the users
computer and and text file sessions in sessions that
information is stored
inside a global variable(Dallas Website Development) so i for their here named sessions
and i'm going to
create a new file and i'm going to name it one that ph the
way we start
session and b c use using a function sessions right at this
point the global
variable on the core session becomes available so we can now
set our session
valley is so we can today for example and you can treat this
session you can
think of the session global era global variable has an era
so we can said
the new named gene called username and said into a value and
also set of
some other one [COUGH] what i'm going to do here in named
role and at this
point let me just use my function to print out the iran and
a better way and
i'm going to say pre are session to print out the rate and
i'm going to open
it and as you can see the being variable rate has been
printed out and
everything is working is expected now we can also say on
this which session
variables had been set because the be hard to go and so on
this page we're
setting our session variables now in order for us to check
at the session is
working on other pages i'm going to create an a page and the
gang came into
and i knew that each and i'm going to create html link i
think into that
page the that with two of the game and on this page want
every page you have
to their you're going to be access in your session variables
and you also
have to use the function stations starred otherwise you're
not going to have
access to that global session variable and at this and the
information is
going to be available to us on this page as well so contest
that out by
printing out there session or a and i'm going to go ahead
and run one the
page me now which is the first page where we're setting that
sessions
variables section very well have been set and if i got to to
that pc as you
can see that session keys and values are still available
because well what
we have successfully set the session and now we're access in
them on the
second page so that how sessions work and that's a simple is
that now we can
also modify session variables for example i can save session
his name
because these a reality i can say said antinori username and
then we can
print recession again that's what happens and i'm going to
go ahead and
open up one that they speak with on the link and now the you can
see our original
values as well as the new valley so that's how you might have
fire session
variables easy and let's see here lastly if you want to and
the session you
use a function called session this underscore destroyed at
this point our
social bees troy so if i around this file we need to that
says can see this
session keys are not available in a more because we have
destroyed [SMACK]
and and if i go back to one which is where we are setting
our session
variables and then got a page too then all of our tease
valleys have become
available(Dallas Website Development) so by using session destroy you're destroyed the
session and raise
the session the re as well so that's how sessions work if
you guys found
this useful please like sharon saw scribe and i'll see next
time clever
taking out

No comments:
Post a Comment