简体   繁体   English

从控制器传递变量以查看Codeigniter中的问题

[英]issue with passing variable from controller to view in codeigniter

This is my Code Of Controller 这是我的控制器代码

    $datacc['user_id'] = $this->user_id;
    $this->load->view("Templates/header",$this->data);
    $this->load->view("Tax/Tax_Search",$datacc);
    $this->load->view("Tax/Tax",$datacc);

in this, i want to pass "$datacc" to my both view files ( Tax.php And Tax_Search ) but $datacc can't pass to Tax_Search.php file 在此,我想将“ $ datacc”传递给我的两个视图文件( Tax.php和Tax_Search ),但是$ datacc无法传递给Tax_Search.php文件

can anyone help? 有人可以帮忙吗?

Thank You 谢谢

You cannot call multiple view in one controller function. 您不能在一个控制器功能中调用多个视图。 This can be done in view file. 这可以在视图文件中完成。

I suggest you that you should first create a template file and in that template call your views like this 我建议您首先创建一个模板文件,然后在该模板中调用您的视图

template.php
   $this->load->view("Tax/Tax");
   $this->load->view("Tax/Tax_search");
   <?php echo $content; ?>
   $this->load->view("Tax/footer");

Let me know if you have queries 让我知道你是否有疑问

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM