上面几楼的不都说了吗? 给你个例子 <?php setcookie("","", ); ?> 把这个放在最顶上试试 setcookie在向浏览器发送请求时,不能有任何数据输出到浏览器 setcookie() defines a cookie to be sent along with the rest of the HTTP headers. Like other headers, cookies must be sent before any output from your script (this is a protocol restriction). This requires that you place calls to this function prior to any output, including <html> and <head> tags as well as any whitespace. If output exists prior to calling this function, setcookie() will fail and return FALSE. If setcookie() successfully runs, it will return TRUE. This does not indicate whether the user accepted the cookie.
给你个例子
<?php
setcookie("","", );
?>
把这个放在最顶上试试
setcookie在向浏览器发送请求时,不能有任何数据输出到浏览器
setcookie() defines a cookie to be sent along with the rest of the HTTP headers. Like other headers, cookies must be sent before any output from your script (this is a protocol restriction). This requires that you place calls to this function prior to any output, including <html> and <head> tags as well as any whitespace. If output exists prior to calling this function, setcookie() will fail and return FALSE. If setcookie() successfully runs, it will return TRUE. This does not indicate whether the user accepted the cookie.