“An error occurred while handling another error: yii\web\HeadersAlreadySentException”

后端 未结 2 1847
孤独总比滥情好
孤独总比滥情好 2020-12-17 15:22

I am trying to submit a comment on a guestbook application based on the Yii 2 Framework. On localhost on my PC works everything fine, but on the shared hosting when I want t

2条回答
  •  抹茶落季
    2020-12-17 16:11

    Although I accept rob006's solution as correct, I have encountered a situation where there was no echo in the controller, but I also got the error. After going through several sites looking for a solution, I discovered an alternative.

    You can check the php.ini file and ensure the output buffer is enabled. If not, you can enable it by adding this line in php.ini if it does not exist:

    output_buffering = on
    

    And turn it off for just the script - the script where it is not required by either...

    1. calling ob_end_flush(), or
    2. calling ob_end_clean()

提交回复
热议问题