“标题已经发送”,但是“没有输出开始...”
我得到php警告:session_start():在已经发送标题后无法启动会话...
错误消息。
我读了许多类似的问题,但是就我而言,上述错误消息不包含(输出启动在/some/file.php:12)
part,没有它,我无法解决问题。
如何在... 零件上添加到错误消息中的输出?
我通过NGINX使用php-fpm的PHP 8.0,以下概念证明WordPress插件触发了错误:
add_action('init', function() {
session_start();
});
没有其他插件激活,我正在使用库存二十二十一名主题。
I get the PHP Warning: session_start(): Session cannot be started after headers have already been sent in ...
error message.
I read many similar questions, but in my case, the above error message doesn't contain the (output started at /some/file.php:12)
part, and without it, I'm unable to resolve the issue.
How can I get the output started at ...
part added to the error message?
I use PHP 8.0 with PHP-FPM via NGINX, and the following proof-of-concept WordPress plugin triggers the error:
add_action('init', function() {
session_start();
});
There are no other plugins activated, and I'm using the stock Twenty Twenty-Two theme.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
其他地方已经输出数据,因此Session_start()导致了该错误。
尝试在该插件部分代码上替换Session_start()。
Other place already output the data so session_start() caused that error.
Try replace session_start() with this one on that plugin section code.