bool headers_sent ([ string &$file [, int &$line ]] )
它将检查报头是否已发送。
Sr.No | 参数 |
---|---|
1 |
file 它包含有关文件或行参数的信息 |
2 |
line 它包含开始输出的行号。 |
如果标头已经发送,则返回TRUE,否则返回FALSE
链接:https://www.learnfk.comhttps://www.learnfk.com/php/php-function-headers-sent.html
来源:LearnFk无涯教程网
<?php if (!headers_sent()) { header('Location: http://www.learnfk.com/'); exit; } if (!headers_sent($filename, $linenum)) { header('Location: http://www.learnfk.com/'); exit; } else { echo "Headers already sent in $filename on line $linenum\n" . "Cannot redirect, for now please click this <a " . "href =\"http://www.learnfk.com\">link</a> instead\n"; exit; } ?>
以上示例将检查标头是否已发送,如果已发送,则显示消息,否则将发送标头
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)