Home > Backend Development > PHP Tutorial > CI模板中php脚本的使用

CI模板中php脚本的使用

WBOY
Release: 2016-06-23 13:52:13
Original
971 people have browsed it

今天偶然发现,在CI的模板中能够直接使用CI自带的函数,并且可以直接调用controller里面的属性。案例:

控制器:

public function test(){     $this->a = 'aaa';     $this->load->view('member/test',$data);} 
Copy after login

模板:

<?php var_dump($this->a);?><?php echo base_url();?><br><?php echo $this->uri->segment(4);?>
Copy after login
输入url:trunk.com/member/index/test/bbb

打印结果:

string 'aaa' (length=3)
http://trunk.com/
ss

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template