Php Set Raw Cookie Function

What is Setrawcookie Function?

Explanation

The "Setrawcookie" function sends an HTTP cookie without URL encoding the cookie value.

Syntax:


setrawcookie(name,value,expire,path,domain,secure)

In the above syntax "name" specifies the name of the cookie, "value" specifies the value of the cookie, "expire" specifies when the cookie expires, "path" specifies the server path of the cookie, "domain" specifies the domain name of the cookie,"secure" specifies whether a cookie should be transmitted or not over a secure connection.

Example :


<?php
$value = "this cookie value";
setrawcookie("TestCookie",$value, time()+3600*24);
?>

In the above example a string is assigned to the simple cookie, and the cookie is set a expiry time of 24 hours.

PHP Topics


Ask Questions

Ask Question