PHP头redirect工作在nginx甚至输出发送

注意:有一个类似的问题,但这是关于Apache。

下面的代码

<?php echo '.'; header('Location: http://stackoverflow.com'); 

完全“工作”在Nginx 0.7.67下,其中“工作”意味着PHP的redirect工作正常,没有在错误日志中的错误或显示.

我如何强制nginx或php-fpm抛出PHP Warning: Cannot modify header information - headers already sent by警告PHP Warning: Cannot modify header information - headers already sent by

你应该在php.ini文件中检查output_buffering参数的值。

php.ini#输出缓冲