简体   繁体   English

PHP 重现警告“无法修改 header 信息 - 标头已由(输出开始于...”与 XAMPP 8..1.1

[英]PHP reproduce warning "Cannot modify header information - headers already sent by (output started at... " with XAMPP 8..1.1

I'm using XAMPP 8.1.1 as dev.我正在使用 XAMPP 8.1.1 作为开发人员。 environment.环境。 In the php.ini is set: error_reporting = E_ALL在 php.ini 中设置:error_reporting = E_ALL

With this code I'm expecting the warning: "Cannot modify header information - headers already sent by..."使用此代码,我期待警告:“无法修改 header 信息 - 标头已由...发送”

<?php
echo 'It works!<br>';
//Expected Warning "Cannot modify header information - headers already sent by"
header ('Content-Type: text/html; charset=utf-8');

echo '<br>...not!';
?>

If I call this function my ISP, I will get the warning, but not on my XAMPP installation.如果我将此 function 称为我的 ISP,我会收到警告,但不会在我的 XAMPP 安装中。 What should I change, that I will get this warning too on my XAMPP installation?我应该改变什么,我也会在我的 XAMPP 安装中收到这个警告? I don't have access to the php.ini File at my ISP to compare the settings, all I found out, is that the error reporting is a little bit less strict, but with the same settings on my XAMPP, I do even not get the warning.我无法访问我的 ISP 处的 php.ini 文件来比较设置,我发现的只是错误报告不那么严格,但是在我的 XAMPP 上使用相同的设置,我什至没有得到警告。

Thank you very much for your help.非常感谢您的帮助。

Your ISP has output buffering disabled.您的 ISP 禁用了 output 缓冲。 On your XAMPP installation it's enabled.在您的 XAMPP 安装上,它已启用。 Outputting content before sending headers will not generate the warning unless content length exceeds configured output_buffering value (4096 by default).在发送标头之前输出内容不会产生警告,除非内容长度超过配置的output_buffering值(默认为 4096)。 https://www.php.net/manual/en/outcontrol.configuration.php https://www.php.net/manual/en/outcontrol.configuration.php

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 PHP - 无法修改标头信息 - 标头已由(输出开始于 - PHP - cannot modify header information - headers already sent by (output started at 在CSV下载期间-警告:无法修改标头信息-已发送的标头(输出始于 - During CSV downloading - Warning: Cannot modify header information - headers already sent by (output started at 警告:无法修改已发送的标头信息标头(输出始于(/themes/kaboodle/functions/admin-setup.php - Warning:Cannot modify header information-headers already sent by (output started at (/themes/kaboodle/functions/admin-setup.php 为什么收到警告:无法修改标头信息-标头已经发送过(输出从...开始)? - Why am I getting Warning: Cannot modify header information - headers already sent by (output started at …)? 如何删除警告无法修改标头信息-标头已发送 - How to remove warning Cannot modify header information - headers already sent by 警告:无法修改标头信息-标头已发送 - Warning: Cannot modify header information - headers already sent by 警告:无法修改标题信息 - 标题已在 wordpress 中发送 - Warning: Cannot modify header information - headers already sent by in wordpress 关于警告的奇怪错误:无法修改标题信息-没有空格PHP时已经发送的标题 - Strange error regarding Warning: Cannot modify header information - headers already sent by when there is no white space PHP Wordpress提要:PHP警告无法修改标题信息-标题已发送 - Wordpress Feeds: PHP Warning Cannot modify header information - headers already sent PHP setcookie()给出“无法修改标题信息 - 标题已发送”警告 - PHP setcookie() gives “Cannot modify header information – headers already sent” warning
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM