Sending a Cookie to the Browser in PHP

Q

How To Send a Cookie to the Browser in PHP?

✍: FYIcenter.com

A

If you want to sent a cookie to the browser when it comes to request your PHP page, you can use the setcookie( ) function. Note that you should call setcookie() function before any output statements. The following script shows you how to set cookies:

<?php
  setcookie("LoginName","FYICenter");
  setcookie("PreferredColor","Blue");
  print("2 cookies were delivered.\n");
?>

 

Receiving a Cookie from the Browser in PHP

What Is a Cookie in PHP

Understanding and Managing Cookies in PHP

⇑⇑ PHP Tutorials

2016-11-04, 1600🔥, 0💬