An Error occurred while handling another error:
#0 /xxxx/xxxx/vendor/yiisoft/yii2/web/Response.php(339): yii\web\Response->sendHeaders()
#1 /xxxx/xxxx/vendor/yiisoft/yii2/web/ErrorHandler.php(135): yii\web\Response->send()
exception
'yii\web\HeadersAlreadySentException' with message 'Headers already sent in /xxxx/xxxx/xxx.php on line 90.' in /xxxx/xxxx/vendor/yiisoft/yii2/web/Response.php:366
Stack trace:#0 /xxxx/xxxx/vendor/yiisoft/yii2/web/Response.php(339): yii\web\Response->sendHeaders()
#1 /xxxx/xxxx/vendor/yiisoft/yii2/web/ErrorHandler.php(135): yii\web\Response->send()
#2/xxxx/xxxx/vendor/yiisoft/yii2/base/ErrorHandler.php(111):
yii\web\ErrorHandler->renderException(Object(yii\web\HeadersAlreadySentException))
#3 [internal function]: yii\base\ErrorHandler->handleException(Object(yii\web\HeadersAlreadySentException))#4 {main}
使用echo 输出json格式输出,结尾没有加exit导致的报错
本文介绍了一个在Yii2框架中遇到的HeadersAlreadySent异常,该异常由使用echo输出JSON格式数据且未正确结束输出所引起。文章详细解释了异常产生的原因及堆栈跟踪,并提供了修正此问题的方法。
1485

被折叠的 条评论
为什么被折叠?



