<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.sessionhandler.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'fr',
  ),
  'this' => 
  array (
    0 => 'sessionhandler.gc.php',
    1 => 'SessionHandler::gc',
    2 => 'Nettoie les anciennes sessions',
  ),
  'up' => 
  array (
    0 => 'class.sessionhandler.php',
    1 => 'SessionHandler',
  ),
  'prev' => 
  array (
    0 => 'sessionhandler.destroy.php',
    1 => 'SessionHandler::destroy',
  ),
  'next' => 
  array (
    0 => 'sessionhandler.open.php',
    1 => 'SessionHandler::open',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'fr',
    'path' => 'reference/session/sessionhandler/gc.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="sessionhandler.gc" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">SessionHandler::gc</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.4.0, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">SessionHandler::gc</span> &mdash; <span class="dc-title">Nettoie les anciennes sessions</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-sessionhandler.gc-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>SessionHandler::gc</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$max_lifetime</code></span>): <span class="type"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">
   Nettoie les sessions expirées. Appelé aléatoirement en interne par PHP lorsqu&#039;une
   session démarre ou lorsque la fonction <span class="function"><a href="function.session-start.php" class="function">session_start()</a></span> est appelée.
   La fréquence d&#039;appel est basée sur les directives de configuration
   <a href="session.configuration.php#ini.session.gc-divisor" class="link">session.gc_divisor</a> et
   <a href="session.configuration.php#ini.session.gc-probability" class="link">session.gc_probability</a>.
  </p>
  <p class="para">
   Cette méthode se substitue au gestionnaire interne de sauvegarde PHP défini via l&#039;option
   de configuration <a href="session.configuration.php#ini.session.save-handler" class="link">session.save_handler</a>
   qui a été définie avant que ce dernier ne le soit via la fonction
   <span class="function"><a href="function.session-set-save-handler.php" class="function">session_set_save_handler()</a></span>.
  </p>
  <p class="para">
   Si cette classe est étendue par héritage, l&#039;appel à la méthode parente <code class="parameter">gc</code>
   invoquera l&#039;enveloppe pour cette méthode, mais aussi, invoquera en interne la fonction de rappel
   associée. Ce comportement permet à cette méthode d&#039;être surchargée ou bien d&#039;être interceptée
   et filtrée.
  </p>
  <p class="para">
   Pour plus d&#039;informations sur l&#039;attendu de cette méthode, se référer à la documentation
   sur la fonction <span class="function"><a href="sessionhandlerinterface.gc.php" class="function">SessionHandlerInterface::gc()</a></span>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-sessionhandler.gc-parameters">
  <h3 class="title">Liste de paramètres</h3>
  <dl>
   
    <dt><code class="parameter">max_lifetime</code></dt>
    <dd>
     <p class="para">
      Les sessions qui n&#039;auront pas été mises à jour les dernières
      <code class="parameter">max_lifetime</code> secondes seront supprimées.
     </p>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-sessionhandler.gc-returnvalues">
  <h3 class="title">Valeurs de retour</h3>
  <p class="para">
   Retourne le nombre de sessions supprimées en cas de succès,  ou <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> si une erreur survient.
   Il est à noter que cette valeur est retournée en interne à PHP pour traitement.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-sessionhandler.gc-changelog">
  <h3 class="title">Historique</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Version</th>
      <th>Description</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>7.1.0</td>
      <td>
       Antérieur à cette version, cette fonction retournait <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> en cas de succès.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


</div><?php manual_footer($setup); ?>