开发者

Does loading a view effectively stop a controller in CodeIgniter?

Would the following code in a controller prevent the nextFunction() from running?

$this->load->vie开发者_如何学Pythonw('foo');
nextFunction();


Ostensibly, that seems to be the case. Apparently, CI will combine calls to multiple views into one response, so that you can assemble a page (response) from multiple pieces. However, that doesn't mean that it returns control to the controller.

You can have the call to load return that processed view as a string. That has to allow you to do further processing in the controller.

e.g.

$foo_string = $this->load->view('foo', '', false);
nextFunction();

This would require that you echo $foo_string yourself, so that it's displayed in the browser.

See "Returning views as data" at the very bottom of this page, in the CI user guide.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜