mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 08:58:56 +00:00
Fixed bug #6162.
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@30339 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
023b39c4ce
commit
3bc1986d7f
1 changed files with 32 additions and 12 deletions
|
@ -121,11 +121,11 @@ header ("Pragma: no-cache"); // HTTP/1.0
|
|||
<funcprototype>
|
||||
<funcdef>int <function>setcookie</function></funcdef>
|
||||
<paramdef>string <parameter>name</parameter></paramdef>
|
||||
<paramdef>string <parameter>value</parameter></paramdef>
|
||||
<paramdef>int <parameter>expire</parameter></paramdef>
|
||||
<paramdef>string <parameter>path</parameter></paramdef>
|
||||
<paramdef>string <parameter>domain</parameter></paramdef>
|
||||
<paramdef>int <parameter>secure</parameter></paramdef>
|
||||
<paramdef>string <parameter><optional>value</optional></parameter></paramdef>
|
||||
<paramdef>int <parameter><optional>expire</optional></parameter></paramdef>
|
||||
<paramdef>string <parameter><optional>path</optional></parameter></paramdef>
|
||||
<paramdef>string <parameter><optional>domain</optional></parameter></paramdef>
|
||||
<paramdef>int <parameter><optional>secure</optional></parameter></paramdef>
|
||||
</funcprototype>
|
||||
</funcsynopsis>
|
||||
<para>
|
||||
|
@ -152,13 +152,22 @@ header ("Pragma: no-cache"); // HTTP/1.0
|
|||
<parameter>secure</parameter> indicates that the cookie should
|
||||
only be transmitted over a secure HTTPS connection.
|
||||
</para>
|
||||
<para>
|
||||
<para>
|
||||
Common Pitfalls:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<simpara>
|
||||
Cookies will not become visible until the next loading of a page that
|
||||
the cookie should be visible for.
|
||||
</simpara>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
Cookies must be deleted with the same parameters as they were set with.
|
||||
</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<simpara>
|
||||
Cookies will not become visible until the next loading of a page that
|
||||
the cookie should be visible for.
|
||||
</simpara>
|
||||
<simpara>
|
||||
In PHP3, multiple calls to <function>setcookie</function> in the same
|
||||
script will be performed in reverse order. If you are trying to
|
||||
|
@ -167,9 +176,9 @@ header ("Pragma: no-cache"); // HTTP/1.0
|
|||
<function>setcookie</function> are performed in the order called.
|
||||
</simpara>
|
||||
<para>
|
||||
Some examples follow:
|
||||
Some examples follow how to send cookies:
|
||||
<example>
|
||||
<title><function>setcookie</function> examples</title>
|
||||
<title><function>setcookie</function> send examples</title>
|
||||
<programlisting role="php">
|
||||
setcookie ("TestCookie", "Test Value");
|
||||
setcookie ("TestCookie", $value,time()+3600); /* expire in 1 hour */
|
||||
|
@ -177,6 +186,17 @@ setcookie ("TestCookie", $value,time()+3600, "/~rasmus/", ".utoronto.ca", 1);
|
|||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
Examples follow how to delete cookies send in previous example:
|
||||
<example>
|
||||
<title><function>setcookie</function> delete examples</title>
|
||||
<programlisting role="php">
|
||||
setcookie ("TestCookie");
|
||||
setcookie ("TestCookie", "",time());
|
||||
setcookie ("TestCookie", "",time(), "/~rasmus/", ".utoronto.ca", 1);
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
Note that the value portion of the cookie will automatically be
|
||||
urlencoded when you send the cookie, and when it is received, it
|
||||
|
|
Loading…
Reference in a new issue