Codeigniter查看和回显 [英] Codeigniter View and echo

查看:145
本文介绍了Codeigniter查看和回显的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个函数处理codeigniter网页的侧边栏。

I have a function that which process the side bar of a web page in codeigniter.

如下:

function process_sidebar()
{
$this->load->view("first_access"); // ------------(1)
$this->load->view("second_access");// --------------(2)
echo "Here i want to show some data after loading view second_access"; //pls note here --(3)

$this->load->view("third_access"); // --------------------(4)
$this->load->view("fourth_access"); //-------------------------(5)

}

请检查订单号,但问题是codeigniter不保留订单。

Please check the order numbers,but the problem is codeigniter not keeping the order.

最后显示视图,并显示 echo 部分。

it rendering the view last and showing the echo part first..

如何克服这个问题?

谢谢。

推荐答案

append_output()而不是 echo

You'll want to append_output() rather than echo:

<?php
function process_sidebar()
{
    $this->load->view("first_access"); // ------------(1)
    $this->load->view("second_access");// --------------(2)
    $this->output->append_output("Here i want to show some data after loading view second_access"); //pls note here --(3)
    $this->load->view("third_access"); // --------------------(4)
    $this->load->view("fourth_access"); //-------------------------(5)
}

这篇关于Codeigniter查看和回显的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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