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

登入 CakePHP 是一項非常簡單的任務。您只需使用一項功能即可。您可以記錄任何後台程序(如 cronjob)的錯誤、異常、使用者活動、使用者採取的操作。在 CakePHP 中記錄資料很容易。提供了 log() 函數

Visual Studio Code,也稱為 VS Code,是一個免費的原始碼編輯器 - 或整合開發環境 (IDE) - 可用於所有主要作業系統。 VS Code 擁有大量針對多種程式語言的擴展,可以輕鬆編寫

CakePHP 是一個開源MVC 框架。它使應用程式的開發、部署和維護變得更加容易。 CakePHP 有許多函式庫可以減少大多數常見任務的過載。
