CodeIgniter视图加载不按顺序加载? [英] CodeIgniter view loading not loading in order?

查看:89
本文介绍了CodeIgniter视图加载不按顺序加载?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在CodeIgniter中有一个Controller,代码如下:

  $ this-> load-&第一); 
echoLOL;
$ this-> load-> view(second);但是奇怪的是,当页面呈现时,HTML是:


  LOL 
< div id =firstView>< / div>
< div id =secondView>< / div>

我不知道什么可能导致语句的重新排序。有什么建议么?

解决方案

在代码igninder中渲染视图是在结束时完成的。
如果你希望在你去时呈现他们,你可以做

  echo $ this-> load-> view(first,array(),true); 
echoLOL;
echo $ this-> load-> view(second,array(),true);


I have a Controller in CodeIgniter with the following code:

$this->load->view("first");
echo "LOL";
$this->load->view("second");

But strangely, when the page is rendered, the HTML is:

LOL
<div id="firstView"></div>
<div id="secondView"></div>

I have no idea what could be causing this reordering of the statements. Any suggestions? Might I have overlooked something?

解决方案

Rendering views in code igniter is done at the end. If you wish to render them as you go you can do

echo $this->load->view("first", array(), true);
echo "LOL";
echo $this->load->view("second", array(), true);

这篇关于CodeIgniter视图加载不按顺序加载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆