Php cookie sessions

Does any authority have any information / links on how to integrate a cookie-based session system? I used the / mysql file and I am currently using memcached. I wanted to play with apc sessions, but I thought I would set aside cookies, only I know little about it.

I think I need to write my own session handler class?

+5
source share
1 answer

In PHP, session data is usually stored in a file. The only thing stored in the cookie is the session identifier. When sessions are turned on and a valid session cookie is found, PHP loads the user's session data from the file into a super global one, which is called quite funny. SESSION.

Basic sessions begin with a session_start();call that is called before any text is sent to the browser. then elements are added or removed from the session object using simple indexing of the array, for example.

$_SESSION['favcolour'] = 'blue'; 

later...

$favcolour = $_SESSION['favcolour'];

only basic cookie sessions (without local storage) can be created with a call

 set_cookie('favcolour','blue'[,other params]);

before any text is sent to the browser and then extracted from the superglobal cookie

$favcolour = $_COOKIE['favcolour'];

you do not need to call session_start()if you only make cookie sessions.

[, ] http://www.php.net/manual/en/function.setcookie.php

, , .

DC

, - PHP

http://www.php.net/manual/en/book.session.php

DC

PHP, , session_set_save_handler, . , , - .

, set_cookie $_SESSION ( ) cookie. cookie, $_SESSION.

, , , cookie. - , , - .

DC

+5

All Articles