PHP disables COOKIE to get SESSION
we know that when client browsers are banned from COOKIE, there is no way to use the server side. Because the server - side SESSION is to distinguish different users' SESSION through SESSIONID, the SESSIONID is passed to the server side through the client's COOKIE, more strictly speaking, because after PHP uses the session_start () statement, it sends a header information to the client, which specifies the SESSION meeting. SESSIONID of the word, this SESSIOID is stored in the COOKIE of the client. After COOKIE is banned, of course, SESSIONID can not be saved.
below is the header information of the output of session_start ():
[code]Content-type: text/html
X-Powered-By: PHP/4.3.3
Set-Cookie: PSD=9b577c86baea8a15ebe15b220ee1e180; path=/
Pragma: no-cache
[/code]
now you can make sure that you can't use SESSION after the COOKIE is banned. In this case, the customer is to prohibit COOKIE, and we have to ensure that this part of the user can be used normally, what should we do? The solution is to use the output_add_rewrite_var function of PHP.
this is not afraid of disabling COOKIE, because SESSIONID will automatically follow URL and FORM will appear HIDDEN value of SESSIONID. It is OK to use SESSION at the server side as usual.
Test Code: test.php
[code].lt; php
session_start ();
$_SESSION.#91;'test'.#93;'test'.#93;
output_add_rewrite_var. T; php
session_start ();
print_r ($_SESSION);
.Gt; [/code]