Tools, FAQ, Tutorials:
Receiving a Cookie from the Browser in PHP
How To Receive a Cookie from the Browser in PHP?
✍: FYIcenter.com
If you know that a cookie has been sent to the browser when it was visiting the server previously, you can check the built-in $_COOKIE array, which contains all cookies that were sent by the server previously. The script below shows you how to pickup one cookie from the $_COOKIE and loop through all cookies in $_COOKIE:
<?php
if (isset($_COOKIE["LoginName"])) {
$loginName = $_COOKIE["LoginName"];
print("Received a cookie named as LoginName: ".$loginName."\n");
} else {
print("Did not received any cookie named as LoginName.\n");
}
print("All cookies received:\n");
foreach ($_COOKIE as $name => $value) {
print " $name = $value\n";
}
?>
⇒ Testing Cookies on a Web Server in PHP
⇐ Sending a Cookie to the Browser in PHP
2016-11-04, ∼2586🔥, 0💬
Popular Posts:
How to how to use matched string and groups in replacements with re.sub()? When calling the re.sub()...
How To Read the Entire File into a Single String in PHP? If you have a file, and you want to read th...
What is Azure API Management Publisher Dashboard? Azure API Management Publisher Dashboard is an Azu...
How to add images to my EPUB books Images can be added into book content using the XHTML "img" eleme...
How to use the built-in "context" object in Policy expressions? The built-in "context" object can be...