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脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

SecLists
SecLists是最終安全測試人員的伙伴。它是一個包含各種類型清單的集合,這些清單在安全評估過程中經常使用,而且都在一個地方。 SecLists透過方便地提供安全測試人員可能需要的所有列表,幫助提高安全測試的效率和生產力。清單類型包括使用者名稱、密碼、URL、模糊測試有效載荷、敏感資料模式、Web shell等等。測試人員只需將此儲存庫拉到新的測試機上,他就可以存取所需的每種類型的清單。

PhpStorm Mac 版本
最新(2018.2.1 )專業的PHP整合開發工具

WebStorm Mac版
好用的JavaScript開發工具

記事本++7.3.1
好用且免費的程式碼編輯器

DVWA
Damn Vulnerable Web App (DVWA) 是一個PHP/MySQL的Web應用程序,非常容易受到攻擊。它的主要目標是成為安全專業人員在合法環境中測試自己的技能和工具的輔助工具,幫助Web開發人員更好地理解保護網路應用程式的過程,並幫助教師/學生在課堂環境中教授/學習Web應用程式安全性。 DVWA的目標是透過簡單直接的介面練習一些最常見的Web漏洞,難度各不相同。請注意,該軟體中