Welcome Guest, Not a member yet? Register   Sign In
set_content_type() Doesn't seem to be working?
#3

(This post was last modified: 07-06-2015, 11:06 AM by CroNiX.)

Yes, you need to use a view, OR use set_output() because of the way CI buffers output. If you echo from a controller, that happens before anything else since the controller has to complete before CI will send IT's data out. And using output->set_content_type() is part of that, which is why it doesn't work the way you wrote it and using native PHP header() does.

A workaround is to finish what you started and send your output using output->set_output()
http://www.codeigniter.com/user_guide/li...set_output

$this->output->set_output($partition); //instead of echo $partition
Reply


Messages In This Thread
RE: set_content_type() Doesn't seem to be working? - by CroNiX - 07-06-2015, 11:04 AM



Theme © iAndrew 2016 - Forum software by © MyBB