<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.session.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'de',
  ),
  'this' => 
  array (
    0 => 'function.session-set-cookie-params.php',
    1 => 'session_set_cookie_params',
    2 => 'Setzt die Session-Cookie-Parameter',
  ),
  'up' => 
  array (
    0 => 'ref.session.php',
    1 => 'Session-Funktionen',
  ),
  'prev' => 
  array (
    0 => 'function.session-save-path.php',
    1 => 'session_save_path',
  ),
  'next' => 
  array (
    0 => 'function.session-set-save-handler.php',
    1 => 'session_set_save_handler',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'de',
    'path' => 'reference/session/functions/session-set-cookie-params.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.session-set-cookie-params" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">session_set_cookie_params</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">session_set_cookie_params</span> &mdash; <span class="dc-title">Setzt die Session-Cookie-Parameter</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.session-set-cookie-params-description">
  <h3 class="title">Beschreibung</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>session_set_cookie_params</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$lifetime_or_options</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.string.php" class="type string">string</a></span></span> <code class="parameter">$path</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.string.php" class="type string">string</a></span></span> <code class="parameter">$domain</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></span> <code class="parameter">$secure</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></span> <code class="parameter">$httponly</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span><br>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="para rdfs-comment">Alternative Signatur, verfügbar ab PHP 7.3.0:</p>
  <div class="methodsynopsis dc-description"><span class="methodname"><strong>session_set_cookie_params</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.array.php" class="type array">array</a></span> <code class="parameter">$lifetime_or_options</code></span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="para rdfs-comment">
   Setzen der Cookie-Parameter, die in der <var class="filename">php.ini</var> definiert sind. Diese
   Funktion wirkt sich nur für die Dauer des Scripts aus. Folglich müssen Sie
   <span class="function"><strong>session_set_cookie_params()</strong></span> bei jeder Anfrage und noch
   vor dem Aufruf von <span class="function"><a href="function.session-start.php" class="function">session_start()</a></span> aufrufen.
  </p>
  <p class="para">
   Diese Funktion aktualisiert die Laufzeitwerte der zugehörigen
   Konfigurationsschlüssel, die mittels <span class="function"><a href="function.ini-get.php" class="function">ini_get()</a></span> abgefragt
   werden können.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.session-set-cookie-params-parameters">
  <h3 class="title">Parameter-Liste</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">lifetime_or_options</code></dt>
     <dd>
      <p class="para">
       Bei Verwendung der ersten Signatur, die
       <a href="session.configuration.php#ini.session.cookie-lifetime" class="link">Lebensdauer</a> des
       Session-Cookies in Sekunden.
      </p>
      <p class="para">
       Ein assoziatives <span class="type"><a href="language.types.array.php" class="type Array">Array</a></span>, das die Schlüssel
       <code class="literal">lifetime</code>, <code class="literal">path</code>,
       <code class="literal">domain</code>, <code class="literal">secure</code>,
       <code class="literal">httponly</code> und <code class="literal">samesite</code> enthalten
       kann. Die Werte haben dieselbe Bedeutung wie für die gleichnamigen
       Parameter beschrieben. Der Wert des
       <code class="literal">samesite</code>-Elements sollte entweder
       <code class="literal">Lax</code> oder <code class="literal">Strict</code> sein. Ist eine
       der erlaubten Optionen nicht angegeben, dann ist ihr Standardwert
       derselbe wie für den expliziten Parameter. Wird das
       <code class="literal">samesite</code>-Element nicht angegeben, dann wird das
       SameSite-Attribut des Cookies nicht gesetzt.
      </p>
     </dd>
    
    
     <dt><code class="parameter">path</code></dt>
     <dd>
      <p class="para">
       Der <a href="session.configuration.php#ini.session.cookie-path" class="link">Pfad</a> der Domain, in
       dem das Cookie zur Verfügung steht. Mit einem einfachen Schrägstrich
       (&#039;/&#039;) gilt es für alle Pfade der Domain.
      </p>
     </dd>
    
    
     <dt><code class="parameter">domain</code></dt>
     <dd>
      <p class="para">
       Die Cookie-<a href="session.configuration.php#ini.session.cookie-domain" class="link">Domain</a>,
       z. B. &#039;www.php.net&#039;. Damit die Cookies auf allen Subdomains zur
       Verfügung stehen, muss der Domain wie in &#039;.php.net&#039; ein Punkt
       vorangestellt werden.
      </p>
     </dd>
    
    
     <dt><code class="parameter">secure</code></dt>
     <dd>
      <p class="para">
       Falls auf <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> gesetzt, wird das Cookie nur über
       <a href="session.configuration.php#ini.session.cookie-secure" class="link">sichere</a> Verbindungen
       gesendet.
      </p>
     </dd>
    
    
     <dt><code class="parameter">httponly</code></dt>
     <dd>
      <p class="para">
       Falls auf <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> gesetzt, versucht PHP das
       <a href="session.configuration.php#ini.session.cookie-httponly" class="link">httponly</a>-Flag zu
       senden, wenn das Session-Cookie gesetzt wird.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.session-set-cookie-params-returnvalues">
  <h3 class="title">Rückgabewerte</h3>
  <p class="para">
   Gibt bei Erfolg <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> zurück. Bei einem Fehler wird <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> zurückgegeben.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.session-set-cookie-params-changelog">
  <h3 class="title">Changelog</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>Version</th>
       <th>Beschreibung</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>8.0.0</td>
       <td>
        <code class="parameter">path</code>, <code class="parameter">domain</code>,
        <code class="parameter">secure</code> und <code class="parameter">httponly</code> sind
        jetzt Nullable-Typen.
       </td>
      </tr>

      <tr>
       <td>7.3.0</td>
       <td>
        Eine alternative Signatur, die ein <code class="parameter">options</code>
        Array unterstützt, wurde hinzugefügt. Diese Signatur unterstützt
        ebenfalls das Setzen des SameSite-Cookie-Attributs.
       </td>
      </tr>

      <tr>
       <td>7.2.0</td>
       <td>
        Gibt bei Erfolg <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> zurück. Bei einem Fehler wird <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> zurückgegeben. Zuvor gab die Funktion <span class="type"><span class="type"><a href="language.types.void.php" class="type void">void</a></span></span> zurück.
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.session-set-cookie-params-seealso">
  <h3 class="title">Siehe auch</h3>
  <p class="para">
   <ul class="simplelist">
    <li><a href="session.configuration.php#ini.session.cookie-lifetime" class="link">session.cookie_lifetime</a></li>
    <li><a href="session.configuration.php#ini.session.cookie-path" class="link">session.cookie_path</a></li>
    <li><a href="session.configuration.php#ini.session.cookie-domain" class="link">session.cookie_domain</a></li>
    <li><a href="session.configuration.php#ini.session.cookie-secure" class="link">session.cookie_secure</a></li>
    <li><a href="session.configuration.php#ini.session.cookie-httponly" class="link">session.cookie_httponly</a></li>
    <li><a href="session.configuration.php#ini.session.cookie-samesite" class="link">session.cookie_samesite</a></li>
    <li><span class="function"><a href="function.session-get-cookie-params.php" class="function" rel="rdfs-seeAlso">session_get_cookie_params()</a> - Liefert die Parameter des Session-Cookies</span></li>
   </ul>
  </p>
 </div>


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