avenger Wed Nov 6 11:19:44 2002 EDT
Modified files:
/phpdoc/en/reference/http/functions setcookie.xml
Log:
finished
Index: phpdoc/en/reference/http/functions/setcookie.xml
diff -u phpdoc/en/reference/http/functions/setcookie.xml:1.5
phpdoc/en/reference/http/functions/setcookie.xml:1.6
--- phpdoc/en/reference/http/functions/setcookie.xml:1.5 Wed Oct 30 22:38:55
2002
+++ phpdoc/en/reference/http/functions/setcookie.xml Wed Nov 6 11:19:44 2002
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.5 $ -->
+<!-- $Revision: 1.6 $ -->
<!-- splitted from ./en/functions/http.xml, last change in rev 1.2 -->
<refentry id="function.setcookie">
<refnamediv>
<refname>setcookie</refname>
- <refpurpose>Send a cookie</refpurpose>
+ <refpurpose>����һ�� cookie ��Ϣ</refpurpose>
</refnamediv>
<refsect1>
- <title>Description</title>
+ <title>����</title>
<methodsynopsis>
<type>boolean</type><methodname>setcookie</methodname>
<methodparam><type>string</type><parameter>name</parameter></methodparam>
@@ -18,81 +18,65 @@
<methodparam
choice="opt"><type>int</type><parameter>secure</parameter></methodparam>
</methodsynopsis>
<para>
- <function>setcookie</function> defines a cookie to be sent along
- with the rest of the HTTP headers. Like other headers, cookies
- must be sent <emphasis>before</emphasis> any output from your
- script (this is a protocol restriction). This requires that you
- place calls to this function prior to any output, including
- <literal><html></literal> and <literal><head></literal> tags
- as well as any whitespace. If output exists prior to calling this
- function, <function>setcookie</function> will fail and return &false;.
- If <function>setcookie</function> successfully runs, it will return
- &true;. This does not indicate whether the user accepted the cookie.
- </para>
- <para>
- All the arguments except the <parameter>name</parameter> argument
- are optional. If only the name argument is present, the cookie
- by that name will be deleted from the remote client. You may
- also replace any argument with an empty string
- (<emphasis>""</emphasis>) in order to skip that
- argument. The <parameter>expire</parameter> and
- <parameter>secure</parameter> arguments are integers and cannot
- be skipped with an empty string. Use a zero
- (<emphasis>0</emphasis>) instead. The
- <parameter>expire</parameter> argument is a regular Unix time
- integer as returned by the <function>time</function> or
- <function>mktime</function> functions. The
- <parameter>secure</parameter> indicates that the cookie should
- only be transmitted over a secure HTTPS connection.
- </para>
- <para>
- Once the cookies have been set, they can be accessed on the next page load
- with the <link linkend="reserved.variables.cookies">$_COOKIE</link> or
- <varname>$HTTP_COOKIE_VARS</varname> arrays. Note,
- <link linkend="language.variables.superglobals">autoglobals</link>
- such as <varname>$_COOKIE</varname> became available in PHP
- <ulink url="&url.php.release4.1.0;">4.1.0</ulink>.
- <varname>$HTTP_COOKIE_VARS</varname> has existed since PHP 3.
+ <function>setcookie</function> ������������һ���µ� cookie
+����Ϣ��������ͷ����Ϣһ����cookies
+
+����Ҫ������ļ���<emphasis>��ǰ��</emphasis>��Ҳ����ζ������֮ǰ���㲻������κ��ַ�
+ (���ǹ涨)������
+ <literal><html></literal> �� <literal><head></literal>
+ ��ǩ�Լ�һЩ�ո������Щ��ǩ��ʹ�� <function>setcookie</function>
+����ǰ����������������ʧ�ܲ����� &false;��
+ ֻҪ <function>setcookie</function>
+�����ɹ����У����ܸ���Ϣ�Ƿ��û����ܣ����᷵�� &true;��
+ </para>
+ <para>
+ ���� <parameter>name</parameter> ���⣬�������в������ǿ�ѡ�ġ����ֻ�� name
+ �������⽫��ɾ���ͻ�������Ϊ name
+ �� cookie����Ȼ��Ϊ������ijЩ�������趨�������ΪһЩ���������ַ�
+ (<emphasis>""</emphasis>)��������
+ <parameter>expire</parameter> ��
+ <parameter>secure</parameter> ������Ӧ��Ϊ���� (integers)
+���Ҳ��ܱ���Ϊ���ַ���������� 0
+ ������(<emphasis>0</emphasis>)������
+ <parameter>expire</parameter> ��һ�� Unix ��ʱ�����������
+ <function>time</function> �� <function>mktime</function>
+ ��������á�<parameter>secure</parameter> ���������� cookie
+ ֻ�ڰ�ȫ HTTP �����²ű����͡�
+ </para>
+ <para>
+ �� cookies �����ú����������ҳ��ͨ�� <link
+linkend="reserved.variables.cookies">$_COOKIE</link>
+ �� <varname>$HTTP_COOKIE_VARS</varname> ����ȡ����ֵ����Ҫע����ǣ�<link
+linkend="language.variables.superglobals">autoglobals</link>
+ �� <varname>$_COOKIE</varname> ��ʽ������ PHP
+ <ulink url="&url.php.release4.1.0;">4.1.0</ulink> ����߰汾����
+ <varname>$HTTP_COOKIE_VARS</varname> ��� PHP 3 ��Ϳ���ʹ��.
</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. To test if a cookie was successfully
- set, check for the cookie on a next loading page before the cookie
- expires. Expire time is set via the <parameter>expire</parameter>
- parameter.
+ Cookies ���������������ı�ҳ��Ч��Ҫ����һ�� cookie
+�Ƿɹ����趨����������䵽��֮ǰͨ������һ��ҳ����������ֵ������ʱ����ͨ������
+ <parameter>expire</parameter> �����õġ�
</simpara>
</listitem>
<listitem>
<simpara>
- Cookies must be deleted with the same parameters as they were set with.
+ Cookies ���ᱻ����ͬ���ĺ��趨�� cookie �����ǡ�
</simpara>
</listitem>
<listitem>
<simpara>
- Cookies names can be set as array names and will be available to your
- PHP scripts as arrays but seperate cookies are stored on the users
- system. Consider <function>explode</function> or
- <function>serialize</function> to set one cookie with multiple names
- and values.
+ ��ʵ�������У������ Cookies ���������ó�һ�����飬�������� cookie
+�е�ÿ��Ԫ�ص�ֵ���ᱻ�����������û���ϵͳ�С������������<function>explode</function>
+ �� <function>serialize</function> �������Ѷ�� cookie ֵд�뵽һ�� cookie
+�ļ��С�
</simpara>
</listitem>
</itemizedlist>
</para>
<simpara>
- In PHP 3, multiple calls to <function>setcookie</function> in the same
- script will be performed in reverse order. If you are trying to
- delete one cookie before inserting another you should put the
- insert before the delete. In PHP 4, multiple calls to
- <function>setcookie</function> are performed in the order called.
+ �� PHP 3 �У���ͬһ�� PHP �ű��ж��ʹ�� <function>setcookie</function>
+ ������ cookie�����ᰴ�յ���ķ�ʽ���ֱ�ִ�У��������Ҫ�ڲ�������һ�� cookie
+ ǰɾ��һ�� cookie,������Ȳ���Ȼ����ɾ������ PHP 4 ���ε���
+ <function>setcookie</function> ���ǰ���˳����ִ�еġ�
</simpara>
<para>
- Some examples follow how to send cookies:
+ ����һЩ����˵������η��� cookies:
<example>
- <title><function>setcookie</function> send examples</title>
+ <title><function>setcookie</function> sent examples</title>
<programlisting role="php">
<![CDATA[
setcookie ("TestCookie", $value);
@@ -103,9 +87,7 @@
</example>
</para>
<para>
- When deleting a cookie you should assure that the expiration date
- is in the past, to trigger the removal mechanism in your browser.
- Examples follow how to delete cookies sent in previous example:
+ һ�����ڵ� cookie ���ᱻ�Զ�ɾ��������˵�������ɾ��һ�� cookies:
<example>
<title><function>setcookie</function> delete examples</title>
<programlisting role="php">
@@ -118,11 +100,7 @@
</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
- is automatically decoded and assigned to a variable by the same
- name as the cookie name. To see the contents of our test
- cookie in a script, simply use one of the following examples:
+ Ҫע����� cookie
+��ֵ�ڷ��͵�ʱ��ᱻ�Զ��ı��벢���棬�������ȡ����ʱ�����ֻᱻ�Զ��Ľ��벢�Զ����Լ���ֵ�����Լ�ͬ����һ�������������ͨ�����������������:
<informalexample>
<programlisting role="php">
<![CDATA[
@@ -133,11 +111,8 @@
</informalexample>
</para>
<para>
- You may also set array cookies by using array notation in the
- cookie name. This has the effect of setting as many cookies as
- you have array elements, but when the cookie is received by your
- script, the values are all placed in an array with the cookie's
- name:
+ ��Ҳ��������һ����������� cookie�����������Ʋ�ͬ�� cookie
+�ŵ�һ�������д�š��������ڽ��� cookie
+ ��ʱ��ֻ��ҪҪ��ȡһ������:
<informalexample>
<programlisting role="php">
<![CDATA[
@@ -154,19 +129,11 @@
</informalexample>
</para>
<para>
- For more information on cookies, see Netscape's cookie
- specification at <ulink
- url="&spec.cookies;">&spec.cookies;</ulink>.
+ ���� cookies ����Ľ��ܣ����Բο�������˾�� cookies ˵����
+ <ulink url="&spec.cookies;">&spec.cookies;</ulink>.
</para>
<simpara>
- Microsoft Internet Explorer 4 with Service Pack 1 applied does
- not correctly deal with cookies that have their path parameter
- set.
- </simpara>
- <simpara>
- Netscape Communicator 4.05 and Microsoft Internet Explorer 3.x
- appear to handle cookies incorrectly when the path and time
- are not set.
+ Netscape Communicator 4.05 �� Microsoft Internet Explorer 3.x �� cookie
+��·����ʱ��û�����õ�����»����һЩ���⡣
</simpara>
</refsect1>
</refentry>
--
PHP Documentation Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php