note 80964 added to function.setcookie
| From: | sebasg37 at gmail dot com | Date: | Fri, 08 Feb 2008 15:10:37 +0000 |
| Subject: | note 80964 added to function.setcookie | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-135910@lists.php.net to get a copy of this message | ||
As said, you can avoid the annoying "headers already sent in line..", using the ob_start()
(function that serves as buffer) doing this:
<?php
ob_start();
echo "somtehing";
setcookie("cookie", "value"); /* if you didn't add the ob_start() function
at this point the headers would have been already sent and the cookie have not been saved */
ob_end_flush();
?>
----
Server IP: 190.2.55.3
Probable Submitter: 200.123.133.161
----
Manual Page -- http://www.php.net/manual/en/function.setcookie.php
Edit -- https://master.php.net/note/edit/80964
Del: integrated -- https://master.php.net/note/delete/80964/integrated
Del: useless -- https://master.php.net/note/delete/80964/useless
Del: bad code -- https://master.php.net/note/delete/80964/bad+code
Del: spam -- https://master.php.net/note/delete/80964/spam
Del: non-english -- https://master.php.net/note/delete/80964/non-english
Del: in docs -- https://master.php.net/note/delete/80964/in+docs
Del: other reasons-- https://master.php.net/note/delete/80964
Reject -- https://master.php.net/note/reject/80964
Search -- https://master.php.net/manage/user-notes.php