销毁特定的会话变量

hey guys gt into a small problem...I am developing a quiz application ,I need to have a different session for every quiz that is being played... session_name("random name") session_start(); this helps me to do the work,but I have got another session being started at login page I need to destroy the random name session once the quiz is complete P S:both are two different session

Check the manual on that one: http://php.net/manual/en/function.session-destroy.php

Session_destroy() destroys all of the data associated with the current session. It does not unset any of the global variables associated with the session, or unset the session cookie. To use the session variables again, session_start() has to be called.

In order to kill the session altogether, like to log the user out, the session id must also be unset. If a cookie is used to propagate the session id (default behavior), then the session cookie must be deleted. setcookie() may be used for that.

I believe, that you cannot have two sessions active at the same time. If you need to store your quiz values in the session, then you'll need to prefix their indexes so they are handy and easily destroyed. You could have something like:

$_SESSION['Quiz']['Question1'] = "Yes";
$_SESSION['Quiz']['Question2'] = "No";

then when your finished with the Quiz with

unset($_SESSION['Quiz']);