Differences between php session and cookie

Source: Internet
Author: User
Tags exit in php session

Differences between cookies and sessions in php:

1. cookie data is stored in the client's browser, and session data is stored on the server.

2. Cookies are not very secure. Others can analyze the Cookies stored locally and perform cookie spoofing. session should be used for security reasons.

3. The session will be stored on the server for a certain period of time. When the number of accesses increases, the performance of your server will be relatively occupied. To reduce the server performance, cookies should be used.

4. the maximum size of a single cookie on the client is 3 kb. That is to say, a website cannot store 3 kb of cookies on the client.

Therefore, we recommend that you store important information such as login information as SESSION, and store other information in cookies if necessary.

Articles you may be interested in
  • Differences between php require and include
  • PhpMyAdmin Cannot start session without errors error Solution
  • Differences and usage of return, exit, break, and contiue in PHP
  • Differences between echo, print, print_r, var_export, and var_dump in php
  • Use break, continue, goto, return, and exit in multiple loops in PHP
  • Php Output Control: understanding the differences between ob_flush and flush
  • Differences between window. navigate and window. location. href
  • Empty, is_null, and isset in php

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.