What is session in PHP? How to remove data from a session? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 13

What is session in PHP? How to remove data from a session?

22nd Oct 2018, 4:33 AM
Seied Majid Mosavizadeh
Seied Majid Mosavizadeh - avatar
6 Answers
+ 3
مثل کوکی عمل میکنه با این تفاوت که با بستن مرورگر اطلاعات Session پاک میشه
22nd Oct 2018, 4:57 AM
Joseph
Joseph - avatar
+ 3
- A session is a global variable stored on the server. Each session is assigned a unique id which is used to retrieve stored values. Whenever a session is created, a cookie containing the unique session id is stored on the user’s computer and returned with every request to the server.  If the client browser does not support cookies, the unique php session id is displayed in the URL Sessions have the capacity to store relatively large data compared to cookies. - Destroying Session Variables. The session_destroy() function is used to destroy the whole Php session variables. If you want to destroy only single item, you use the unset() function.
25th Oct 2018, 6:27 PM
Shanmugaraja
Shanmugaraja - avatar
+ 1
session_destroy()
28th Oct 2018, 10:19 AM
Farrux
Farrux - avatar
+ 1
Si no sólo te convence utilizar session_destroy() antes de eso reinicie la variable $_SESSION = array(); y listo, saludos.
2nd Nov 2018, 12:50 AM
Antonio Salgado
Antonio Salgado - avatar
+ 1
session is used to track the user from one page to another on a site, using the user information like username or email or surname but I prefer using email because it's unique, Example <?php session_start() ; $_SESSION["email"] = $_POST["User Email" ] ;//this stage you have collected email from the user and store it in a session so if the user navigate from one page to another the session tracks him except if the session is destroyed using session_destroy() ;
31st Jan 2019, 8:23 PM
Decodeworms Olamilekan
Decodeworms Olamilekan - avatar
- 1
جملات شرطی چطوره درc#
26th Oct 2018, 8:59 PM
Mo Na
Mo Na - avatar