How to add a cookie?

Answer Posted / rupali

bool setcookie ( string $name [, string $value [, int
$expire [, string $path [, string $domain [, bool $secure
[, bool $httponly ]]]]]] )
for e.g.
<?php
$value = 'something from somewhere';

setcookie("TestCookie", $value);
setcookie("TestCookie", $value, time()+3600); /* expire in
1 hour */
setcookie("TestCookie", $value, time()
+3600, "/~rasmus/", ".example.com", 1);
?>

Is This Answer Correct ?    7 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is mean tnq

1280


Does php has a future?

678


Which is better php or nodejs?

704


Is numeric in php?

750


In how many ways we can retrieve the data in the result set of mysql using php?

698


Is ruby on rails php?

706


What is the super method?

760


What is array filter php?

714


Write down the benefits of php7?

801


What websites use php?

722


What is a trait in php?

756


which will print out the php call stack?

752


What is psr in php?

798


How can we change the maximum size of the files to be uploaded?

769


How can MYSQL functions be available with PHP?

755