Is there any reasonable way to check if the output has already been sent to the browser and sending the header will create PHP_WARNING?
Obviously, there is an alternative to using the output buffer, but this is not always an option.
You can use the headers_sent () method. This is because, before anything comes out, headers will be sent first.
if (headers_sent()) { trigger_error("Here you got your warning", E_WARNING); }
headers_sent()
, :
$old_er = error_reporting(0); header(...) error_reporting($old_er);
PHP- ( , IMO).
Source: https://habr.com/ru/post/1706583/More articles:В чем разница между представлением диспетчера и сервисом для работы с шаблоном проектирования? - java-eehttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1706579/php-serverremoteaddr-sometimes-resolves-to-empty-string&usg=ALkJrhgpydepxlgJ7EO3lUR1J8pdDRDsZgRunning more than one instance of Evince - linuxPHP - вычисление большого целочисленного модуля - mathUsing java, how do you get the amount of free space on the Solaris zfs file system? - javaWhen should all thread synchronization objects be used? - multithreadingUnable to edit tags in CListCtrl - c ++How to encrypt data after using ajax and jquery? - jqueryCannot start JUnit test case containing streams from Eclipse - eclipseAre there any other open source JCE libraries besides BouncyCastle? - javaAll Articles