2

PHPでセッションファイルを自動削除したい。

PHP.ini で次の構成を変更する必要があることがわかりました。

  • session.gc_probability
  • session.gc_divisor
  • session.gc_maxlifetime

しかし、これらのプロパティでどの値を変更すればよいかわかりません。

4

2 に答える 2

1

おそらくこの例はあなたを助けるでしょう

 <?php 
 // you have to open the session to be able to modify or remove it 
 session_start(); 

 // to change a variable, just overwrite it 
 $_SESSION['variable_name']='variable_value'; 

 //you can remove a single variable in the session 
 unset($_SESSION['variable_name']); 

 // or this would remove all the variables in the session, but not the session itself 
 session_unset(); 

 // this would destroy the session variables 
 session_destroy(); 
 ?> 
于 2012-04-16T12:26:37.523 に答える
-1

関数を使用してsession_destroy();、作成されたセッション ファイルが自動的に削除されました。

于 2015-08-08T15:09:03.307 に答える