PHP Cookies and Session issues
In PHP, what are the advantages of a cookie compared to a session, except that the cookie is stored on the client side and does not occupy the server's hard drive?
When the PHP processing page, are sent to the client after the server generated a good page, if the data cached in the cookie, it is necessary to send the data to the client, the next time the visit, and then stored in the client cookie data sent to the server, processing and then back to the client ... Does this seem like the process of transmitting data 2 times more than using session cache data? (Session is only read on the server, eliminating the network transmission?) )
I don't know if I understand that, right? If that's the case, it doesn't seem to be advantageous to cache data with cookies ...
I implore you to enlighten me ~
Thank you!
(Is there a slightly simpler way to cache the data on the client, the server processing PHP files without having to read from the client again, but the technology that the client automatically handles?) is the server in the page need to cache data where the tag left, the client read to the tag when the cache to load the data ... )
------Solution--------------------
If you keep the data in session, of course you can, if you have enough memory support?
You can use Js+cookie to do that, but there's a problem with the limited amount of content that a cookie can hold. It's also easy to forge.
------Solution--------------------
Cookie is a burst of ah, not safe ah, the client to compile what the server letter is not the egg hurt.
A cookie is a degenerate session technology that has no effect on the logic and security of the server.
If a user logs in, you send the user a cookie to mark that the user is logged in, and it's finished.
The bad guys just analyze the format of this cookie, use any account name can be fabricated out, but also play hair ah.
As long as the client can directly touch things are not safe.
------Solution--------------------
So how do you delete the contents of deleted records in a large amount of cached data?
In particular, each query database involves a large number of joint, Cartesian product and other operations, the content of the result set may be very large changes (associated with the deleted record, the Cartesian product part does not exist)
------Solution--------------------
In addition, the SESSION, the COOKIE belongs to the user's private
While deleting records is a public event, you can't always say that when you delete a record, it's not valid.
Assuming there are now 10,000 users online, how do you plan to update their cache?
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