문제

I have 5 Session in my script. I want to destroy two from them.

<?php
  session_start();
  $_SESSION['productid'] = "123";
  $_SESSION['imglink'] = "x.png";
  $_SESSION['oldprize'] = "120";
  $_SESSION['spacialprize'] = "100"
  $_SESSION['productname'] = "AC";
?>
도움이 되었습니까?

해결책

You can use unset() for this as:

unset($_SESSION['productname']);

$_SESSION['productname'] is a variable and unset() destroys any variable placed within it.

다른 팁

This is only a Session Value:

$_SESSION['productname'] = "AC";

If you want to "destroy" this, you can use following function:

unset($_SESSION['productname']);

If you use "session_unset();" and "session_destroy();" your whole session values are destroyed, and you have to restart a session.

unset($_SESSION['productname']); unset($_SESSION['productname']);

"session_destroy():" will destroy the whole session

Use the following


unset($_SESSION['productname']);
 
unset($_SESSION['productname']);

After this, your session will be deleted.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top