Php,cookie) Details of the properties and validity period

Source: Internet
Author: User

(1) The validity period of a cookie:

Default: The end of the session cycle (that is, the browser is off), by default, the cookie will expire when the browser is closed, which is a temporary cookie or a session.

Support set the validity period, the third parameter of Setcookie, can set the validity period of the cookie, and the validity period is represented by a timestamp. (This is set for 60 seconds, but the cookie expires in a minute regardless of whether the browser is off)

            

So who's to judge if this cookie is invalid or ineffective? is the browser, when the server sets a cookie, and also tells the browser ' I ' currently sends a cookie that expires in 60 seconds.

              

              

(2) Special syntax:

        

(3) Valid path to cookies:

The cookie is valid in the current directory and in the descendant directory, as long as it is not recognized in the directory above his current directory.

So, I just set this cookie in my root directory, so it works for the whole station.

    

In this php34 directory, I set the value of the cookie in cookie_1.php, which can be accessed in cookie_2.php, while in kang/cookie_kang_1.php and Kang/cookie_kang_2. PHP can also be accessed,

However, if I set the value of the cookie in kang/cookie_kang_1.php or kang/cookie_kang_2.php, then the cookie_1.php or cookie_2.php outside will not be able to access it.

(This is about the effective path of the cookie)

The request is not related to the local disk path, and it has something to do with your URL (no, it's too esoteric).

Re-hardening: Require is to copy files intact to this location,

Php,cookie) Details of the properties and validity period

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.