Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
可能重复: codeigniter:将数据传递给视图中包含的视图
如何将变量从视图传递到其中的另一个视图?(codeigniter)
感谢:D
如果您的意思是,您在一个视图中设置了一个变量,那么您在该视图中调用另一个视图,并且您想在那里使用它,这是最简单的方法,在调用视图的控制器中设置它。
$data['var'] = 'value'; $this->load->view('view file',$data);
然后你可以在每个子视图中达到它。