Wednesday, 20 September 2017

php - I can't setcookie "headers already sent"


Possible Duplicate:
“Warning: Cannot modify header information - headers already sent by” error
setcookie, Cannot modify header information - headers already sent






I have this code to set cookie :



if (!isset($_COOKIE["CorkIU"])) {

setcookie("CorkIU", 2dd2ee3aUgsvoRye, time()+60*60*24*365, "/");
}


I have added this code in layout.php file



The first lines from layout.php file is







include ("inc/css.php");

if (!isset($_COOKIE["CorkIU"])) {
setcookie("CorkIU", 2dd2ee3aUgsvoRye, time()+60*60*24*365, "/");
}

?>


Welcome To Example





and here is the error :



Warning: Cannot modify header information - headers already sent by (output started at /home/ex/public_html/template/layout.php:4) in /home/ex/public_html/template/layout.php on line 8

No comments:

Post a Comment

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...