Tools, FAQ, Tutorials:
Specifying Domain and Path for a Cookie in PHP
How To Specify Domain and Path for a Cookie in PHP?
✍: FYIcenter.com
If you want to specify domain and path for cookie, you can use the setcookie() function with two extra parameters. The sample PHP script below shows you how to set the domain and path attributes for temporary and persistent cookies:
<?php
setcookie("LoginName","FYICenter", NULL, "/", ".fyicenter.com");
setcookie("PreferredColor","Blue", NULL, "/", ".fyicenter.com");
setcookie("CouponNumber","07470433",time()+60*60*24*7,
"/store", ".fyicenter.com");
setcookie("CouponValue","100.00",time()+60*60*24*7,
"/store", ".fyicenter.com");
print("2 temporary cookies were delivered.\n");
print("2 consistent cookies were delivered.\n");
?>
⇒ Mistake on Setting Cookie Path and Domain in PHP
⇐ Domain and Path Attributes for Cookies in PHP
2016-11-03, ∼2572🔥, 0💬
Popular Posts:
How to install "C++/CLI Support" component in Visual Studio? I need to build my Visual Studio C++/CL...
How To Merge Cells in a Column? If you want to merge multiple cells vertically in a row, you need to...
Where to find tutorials on Visual Studio? I want to know How to learn Visual Studio. Here is a large...
How To Get the Minimum or Maximum Value of an Array in PHP? If you want to get the minimum or maximu...
What is EPUB 3.0 Metadata "dc:publisher" and "dc:rights" elements? EPUB 3.0 Metadata "dc:publisher" ...