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"); ?>
Â
⇒Understanding and Managing Cookies in PHP
⇒⇒PHP Tutorials
2016-11-03, 1124👍, 0💬
Popular Posts:
How to write a policy to set and get custom variables? Here is a policy that sets and gets custom va...
How to install .NET Framework in Visual Studio Community 2017? I have the Visual Studio Installer in...
Where to find tutorials on JSON (JavaScript Object Notation) text string format? I want to know how ...
How to use the Atom Online Validator at w3.org? w3.org feed validation service is provided at http:/...
How to add an API to an API product for internal testing on the Publisher Portal of an Azure API Man...