Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我已经遵循 PHP 代码
<?php header("HTTP/1.0 200 OK"); if(headers_sent()){ echo "Header Sent"; } else{ echo "Header Not Sent"; } ?>
我仍然收到“标题未发送”的消息。
表示不发送响应代码。如何解决?
使用标头之前ob_start();和之后ob_end_flush();
ob_start();
ob_end_flush();
ob_start(); header("HTTP/1.0 200 OK"); ob_end_flush(); if(headers_sent()){ echo "Header Sent"; } else{ echo "Header Not Sent"; }
尝试刷新输出缓冲区
<?php flush(); ...