i want exclude debug infomation when output csv |
hello
this is simple csv. I try output the csv. PHP Code: public function csvExport(): string Why is debug code also output? https://user-images.githubusercontent.co...94fb65.png
You may need to turn off the Debug Toolbar.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
Use $option debug. See https://codeigniter4.github.io/CodeIgnit....html#view
PHP Code: view('view_file', $data, ['debug' => false]);
@InsiteFX @kenjis
thanks every time. The cause this time seemed to be that a string was returned upon return. I stopped returning view and replaced it with exit PHP Code: public function csvExport(): string Why can I write to a closed CSV? after fclose command. Is 'php://output' involved?
In fact, CI4 does not support stream output except in case of downloading an existing file.
See https://codeigniter4.github.io/CodeIgnit...e-download Even if you want to output stream in your controller, all output will be buffered and sent by the framework. If you need to disable the output buffering, put the following code before your stream output. PHP Code: while (ob_get_level() > 0) {
@kenjis
thanks. I understanded this fact. I was referring to was probably not the CodeIgniter4 way. I have searched for "Codeigniter4 csv" and found that the way to do this `exit()` seems to be ok for now. https://makitweb.com/how-to-export-data-...igniter-4/
The code in that article is terrible, but it is also true that there is currently no way to write it cleanly.
I suppose it would be better to add a StreamResponse class to be able to return a stream. |
Welcome Guest, Not a member yet? Register Sign In |