function.session-set-cookie-params.html
来自「php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容」· HTML 代码 · 共 199 行
HTML
199 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Set the session cookie parameters</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.session-save-path.html">session_save_path</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.session-set-save-handler.html">session_set_save_handler</a></div> <div class="up"><a href="ref.session.html">Session Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><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)</p><p class="refpurpose"><span class="refname">session_set_cookie_params</span> — <span class="dc-title">Set the session cookie parameters</span></p> </div> <div class="refsect1 description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type"><span class="type void">void</span></span> <span class="methodname"><b><b>session_set_cookie_params</b></b></span> ( <span class="methodparam"><span class="type">int</span> <tt class="parameter">$lifetime</tt></span> [, <span class="methodparam"><span class="type">string</span> <tt class="parameter">$path</tt></span> [, <span class="methodparam"><span class="type">string</span> <tt class="parameter">$domain</tt></span> [, <span class="methodparam"><span class="type">bool</span> <tt class="parameter">$secure</tt></span> [, <span class="methodparam"><span class="type">bool</span> <tt class="parameter">$httponly</tt></span> ]]]] )</div> <p class="para rdfs-comment"> Set cookie parameters defined in the <var class="filename">php.ini</var> file. The effect of this function only lasts for the duration of the script. Thus, you need to call <b>session_set_cookie_params()</b> for every request and before <a href="function.session-start.html" class="function">session_start()</a> is called. </p> </div> <div class="refsect1 parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><i><tt class="parameter">lifetime</tt></i></span> <dd> <p class="para"> Lifetime of the session cookie, defined in seconds. </p> </dd> </dt> <dt> <span class="term"><i><tt class="parameter">path</tt></i></span> <dd> <p class="para"> Path on the domain where the cookie will work. Use a single slash ('/') for all paths on the domain. </p> </dd> </dt> <dt> <span class="term"><i><tt class="parameter">domain</tt></i></span> <dd> <p class="para"> Cookie domain, for example 'www.php.net'. To make cookies visable on all subdomains then the domain must be prefixed with a dot like '.php.net'. </p> </dd> </dt> <dt> <span class="term"><i><tt class="parameter">secure</tt></i></span> <dd> <p class="para"> If <b><tt>TRUE</tt></b> cookie will only be sent over secure connections. </p> </dd> </dt> <dt> <span class="term"><i><tt class="parameter">httponly</tt></i></span> <dd> <p class="para"> If set to <b><tt>TRUE</tt></b> then PHP will attempt to send the httponly flag when setting the session cookie. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> No value is returned. </p> </div> <div class="refsect1 changelog"> <h3 class="title">ChangeLog</h3> <p class="para"> <table class="informaltable"> <colgroup> <thead valign="middle"> <tr valign="middle"> <th colspan="1">Version</th> <th colspan="1">Description</th> </tr> </thead> <tbody valign="middle" class="tbody"> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">5.2.0</td> <td colspan="1" rowspan="1" align="left"> The <i><tt class="parameter">httponly</tt></i> parameter was added. </td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">4.0.4</td> <td colspan="1" rowspan="1" align="left"> The <i><tt class="parameter">secure</tt></i> parameter was added. </td> </tr> </tbody> </colgroup> </table> </p> </div> <div class="refsect1 seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"> <a href="session.configuration.html#ini.session.cookie-lifetime" class="link">session.cookie_lifetime</a> </li> <li class="member"> <a href="session.configuration.html#ini.session.cookie-domain" class="link">session.cookie_domain</a> </li> <li class="member"> <a href="session.configuration.html#ini.session.cookie-secure" class="link">session.cookie_secure</a> </li> <li class="member"> <a href="session.configuration.html#ini.session.cookie-httponly" class="link">session.cookie_httponly</a> </li> <li class="member"><a href="function.session-get-cookie-params.html" class="function" rel="rdfs-seeAlso">session_get_cookie_params()</a></li> </ul> </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.session-save-path.html">session_save_path</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.session-set-save-handler.html">session_set_save_handler</a></div> <div class="up"><a href="ref.session.html">Session Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?