开发者

(Bonfire Module) When a function is called within my controller, I receive "Message: Cannot modify header information - headers already sent" [duplicate]

开发者 https://www.devze.com 2023-04-11 15:09 出处:网络
This question already has answers here: How to fix "Headers already sent" error in PHP (11 answers)
This question already has answers here: How to fix "Headers already sent" error in PHP (11 answers) Closed 10 years ago.

Basically, when the "file_upload" function is called within my modules' controller, I receive the following error.

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at somesite.com/html/bonfire/modules/upload/controllers/content.php:81)

Filename: libraries/Session.php

Line Number: 671

I'm developing a module using Bonfire which is HMVC module development addon for CI.

I've included my model and controller below for yo开发者_StackOverflowur viewing. Please don't be too harsh, I've only recently started learning PHP/CI.

View Cont

Any assistance you could offer would be appreciated.


Either you can call exit after echo json_encode(array('status' => $status, 'msg' => $msg)); in line 81 of your controller or render view with empty layout.Problem is occurring due to calling echo before view render, which sends headers and then view render again sends header

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号