PHP session and Cookie Differences _php tutorial

Source: Internet
Author: User
Tags php session
The difference between a cookie and a session in PHP:

1. The cookie data is stored on the client's browser and the session data is placed on the server.

2, the cookie is not very safe, others can be stored in the local cookie and cookie spoofing, considering that security should use the session.

3. Session will be saved on the server for a certain period of time. When the number of accesses increases, the performance of your server will be compared, and cookies should be used in consideration of mitigating server performance.

4, the limit of a single cookie on the client is 3K, that is, a site in the client store cookies can not be 3 K.

So personal advice: the login information and other important information stored as a session, other information if necessary to retain, can be placed in a cookie .

Articles you may be interested in

    • The difference between PHP require and include
    • PhpMyAdmin cannot start session without errors error resolution
    • The difference and usage of return and exit, break and Contiue in PHP
    • The usage and difference of echo,print,print_r,var_export,var_dump in PHP
    • Usage and differences in PHP that jump out of multiple loops using Break,continue,goto,return,exit
    • PHP Output Control In-depth understanding of the difference between Ob_flush and flush
    • Window.navigate and window.location.href the use of different explanations
    • PHP empty,is_null,isset The difference between the detailed

http://www.bkjia.com/PHPjc/764111.html www.bkjia.com true http://www.bkjia.com/PHPjc/764111.html techarticle the difference between a cookie and a session in PHP: 1. The cookie data is stored on the client's browser and the session data is placed on the server. 2, the cookie is not very safe, others can be analyzed stored in the local ...

  • 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.