php中使用header函数后,页面提示:Warnging: Cannot modify hea
Warning: Cannot modify header information - headers already sent by 的原因 我的php程序调用了header(Location: www.baidu.com );函数, 运行后出现出现 Warning: Cannot modify header information - headers already sent by 的页面警告。 发现原来是
Warning: Cannot modify header information - headers already sent by 的原因
我的php程序调用了header("Location:www.baidu.com");函数,
运行后出现出现 Warning: Cannot modify header information - headers already sent by 的页面警告。
发现原来是我的php.ini里面的配置的问题,
默认的php.ini文件中,output_buffering指令选项的默认值为off。
把它设为4096就解决了显示提示warning错误的提示。.
php.ini 文件对 output_buffering指令选项做了详细说明如下:
94 ; Output buffering allows you to send header lines (including cookies) even 95 ; after you send body content, at the price of slowing PHP's output layer a 96 ; bit. You can enable output buffering during runtime by calling the output 97 ; buffering functions. You can also enable output buffering for all files by 98 ; setting this directive to On. If you wish to limit the size of the buffer 99 ; to a certain size - you can use a maximum number of bytes instead of 'On', as 100 ; a value for this directive (e.g., output_buffering=4096). 101 #output_buffering = Off 102 output_buffering = 4096
最后,重启,使修改后的配置文件生效。
在Linux下,
如果因PHP命令行而修改php.ini 则不需要重启;
如果因Apache而修改php.ini,则需要重启apache服务;
总之,就是那个服务使用了php,就重新启动该服务,就可以了。

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章

热工具

记事本++7.3.1
好用且免费的代码编辑器

SublimeText3汉化版
中文版,非常好用

禅工作室 13.0.1
功能强大的PHP集成开发环境

Dreamweaver CS6
视觉化网页开发工具

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)

PHP 8.4 带来了多项新功能、安全性改进和性能改进,同时弃用和删除了大量功能。 本指南介绍了如何在 Ubuntu、Debian 或其衍生版本上安装 PHP 8.4 或升级到 PHP 8.4

CakePHP 是 PHP 的开源框架。它的目的是使应用程序的开发、部署和维护变得更加容易。 CakePHP 基于类似 MVC 的架构,功能强大且易于掌握。模型、视图和控制器 gu
