while reading about cookies i found difficulty to grasp the following statement
“setcookie() must be called before any output to the HTTP response. The main reason is that PHP is not buffering the HTTP response”
please help me to interpret it in easy way
while reading about cookies i found difficulty to grasp the following statement setcookie() must
Share
To understand that statement, you need to know a few things:
So what it’s saying is: unless you do something special, the instant you “echo” something or have any data outside a
<?...?>block, PHP will begin the response body with that data. After that point, no more headers, including cookie-setting headers, can be sent.