search
Homephp教程php手册Warning: Cannot modify header information - headers already sent by

如果在执行php程序时看到这条警告:"Warning: Cannot modify header information - headers already sent by ....".

有以下几种解决方法:

1. Blank lines (空白行):

,检查 后面没有空白行,特别是include或者require的文件.不少问题是这些空白行导致的。

2. Use exit statement (用exit来解决):在header后加上exit();

header ("Location: xxx");exit();

3.用Javascrīpt来解决:

self.location( file.php );"; ?>

可以用Javascrīpt来代替header。另外需要注意,采用这种方法需要浏览器支持Javascrīpt.

4. 用输出缓存来解决:

<?php
... HTML codes ... 

... PHP codes ... 
header ("Location: ...."); 
ob_end_flush(); 
?>

               
               

永久地址:

转载随意~请带上教程地址吧^^

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Atom editor mac version download

Atom editor mac version download

The most popular open source editor