Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/240.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何删除警告无法修改标题信息-标题已由发送_Php - Fatal编程技术网

Php 如何删除警告无法修改标题信息-标题已由发送

Php 如何删除警告无法修改标题信息-标题已由发送,php,Php,出现“headers ready sent”警告。我关闭$zip->close()但仍显示警告 $zip = new ZipArchive; $download = 'new_zip.zip'; $zip->open($download, ZipArchive::CREATE); foreach (glob("zipfile/*") as $file) { $zip->addFile($file); } $zip->close(); header('Content-T

出现“headers ready sent”警告。我关闭
$zip->close()但仍显示警告

$zip = new ZipArchive;
$download = 'new_zip.zip';
$zip->open($download, ZipArchive::CREATE);
foreach (glob("zipfile/*") as $file) { 
    $zip->addFile($file);
}
$zip->close();
header('Content-Type: application/zip');
header("Content-Disposition: attachment; filename = $download");
header('Content-Length: ' . filesize($download));
header("Location: $download");

在脚本开始时,请使用:

<?php ob_start(); ?>

然后在脚本末尾添加:

<?php ob_flush(); ?>

在脚本开始时,使用:

<?php ob_start(); ?>

然后在脚本末尾添加:

<?php ob_flush(); ?>

在脚本开始时,使用:

<?php ob_start(); ?>

然后在脚本末尾添加:

<?php ob_flush(); ?>

在脚本开始时,使用:

<?php ob_start(); ?>

然后在脚本末尾添加:

<?php ob_flush(); ?>



如果插入
if(headers_sent($from,$line))会发生什么(headers已经发送到:'.$from.'on line:'.$line)下面
$zip->close()?您必须提供页面的完整代码。可能,在尝试在代码的最开始添加html之前,需要检查代码的输出。如果出现问题,将显示输出。
header()
仅在未显示之前的输出时有效。任何(不可见的)输出(如HTML标记)也会被输出。出现此错误的原因是您已经在页面上发送了一些输出,请查看如果(Header_sent($from,$line))死亡(Header已发送到:'.$from。'on line:'.$line),则插入
if(Header_sent($from,$line))会发生什么情况下面
$zip->close()?您必须提供页面的完整代码。可能,在尝试在代码的最开始添加html之前,需要检查代码的输出。如果出现问题,将显示输出。
header()
仅在未显示之前的输出时有效。任何(不可见的)输出(如HTML标记)也会被输出。出现此错误的原因是您已经在页面上发送了一些输出,请查看如果(Header_sent($from,$line))死亡(Header已发送到:'.$from。'on line:'.$line),则插入
if(Header_sent($from,$line))会发生什么情况下面
$zip->close()?您必须提供页面的完整代码。可能,在尝试在代码的最开始添加html之前,需要检查代码的输出。如果出现问题,将显示输出。
header()
仅在未显示之前的输出时有效。任何(不可见的)输出(如HTML标记)也会被输出。出现此错误的原因是您已经在页面上发送了一些输出,请查看如果(Header_sent($from,$line))死亡(Header已发送到:'.$from。'on line:'.$line),则插入
if(Header_sent($from,$line))会发生什么情况下面
$zip->close()?您必须提供页面的完整代码。可能,在尝试在代码的最开始添加html之前,需要检查代码的输出。如果出现问题,将显示输出。
header()
仅在未显示之前的输出时有效。任何(不可见的)输出(如HTML标记)也会被输出。出现该错误的原因是您已经在页面上发送了一些输出,请看一看,虽然这可能会使警告消失,但它并不能解决一些代码产生不应该产生的输出的根本问题。虽然这可能会使警告消失,它不能解决一些代码产生不应该产生的输出的根本问题。虽然这可能会使警告消失,但它不能解决一些代码产生不应该产生的输出的根本问题。虽然这可能会使警告消失,它不能解决一些代码产生不应该产生的输出的根本问题。