how can i find out if the php output already started? [duplicate]

限于喜欢 提交于 2019-12-12 03:45:28

问题


Possible Duplicate:
PHP: how to know if output already started?

I would like to find out if there is already generated output in the buffer before I start the session.

In PHP, an output that started before the session started always creates a warning, for example a bug in the controller creates this output:

Warning: fopen(/tmp/test.txt) [function.fopen]: failed to open stream: Permission denied in /var/www/app/controllers/test_controller.php on line 836

Warning: Cannot modify header information - headers already sent by (output started at test.php:836) in layouts/default.thtml on line 18

This is not the problem, I like that warning so I find out some bugs.

But my layout is designed like that there is a fixed bar at the top of the page that covers the first warning. so I would like to find out if there is already generated output in the buffer before I start the session, so I can quit adding the style fixed to that bar.


回答1:


There is a function for that: headers_sent.



来源:https://stackoverflow.com/questions/12561959/how-can-i-find-out-if-the-php-output-already-started

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!