What is Cookies in Php ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

What is Cookies in Php ?

can anyone tell me the working of cookies and why we use ? and if any cons? tell me please it is confusing for me.

26th Oct 2017, 2:21 PM
~Sudo Bash
~Sudo Bash - avatar
3 Answers
+ 1
Cookies are basically text files that are used to store/retrieve data for the website on the local client machine, such as configurations/login info/etc... Since it's on the local machine, it's quicker and doesn't use up unnecessary network resources. However, it's on the local machine, so it's not secured by your servers/security policies. As such, the data inside of the cookies can be compromised or changed, which is a big con. Because of this, you want to use discernment when you're deciding if you should store something as a cookie or if you should just store it in your site's database for the user.
26th Oct 2017, 3:59 PM
AgentSmith
+ 1
Basically, cookies are text plain data that you can store at the Client browser (pc machine), usually used for save configuration data or session data. You may want to save some configuration that the user save, or maybe some preference selected in your page for that user. Important, cookie are accessible for anyone that can access to the PC, so you must not save sensitive data in cookie that compromise the users. Hope this was useful.
27th Oct 2017, 3:01 PM
edanca
+ 1
this is usefull
27th Oct 2017, 3:15 PM
~Sudo Bash
~Sudo Bash - avatar