后端开发|php教程
php,yii
后端开发-php教程
易语言云盘源码,ubuntu开机没页面,学python爬虫就业,质数 php,辽宁网站seolzw
This is the view content for action "action->id; ?>".The action belongs to the controller ""in the "module->id; ?>" module. 分类筛选 源码,mac用vscode怎么调试,运维ubuntu,win更改tomcat端口,java调度爬虫,php缓存技术都有什么,福建省seo推广知识,php地方门户新闻网站源码,h5 拆红包模板lzw You may customize this page by editing im 即时通讯源码 php,怎样让ubuntu更快,tomcat 是服务器,爬虫躲避制作,php精美登录页面,抖音搜索seo是个什么东西lzwbreadcrumbs=array( $this->module->id,);?>
uniqueId . / . $this->action->id; ?>
我想知道这个$this是哪来的?这也没有类啊!
回复内容:
This is the view content for action "action->id; ?>".The action belongs to the controller ""in the "module->id; ?>" module. You may customize this page by editingbreadcrumbs=array( $this->module->id,);?>
uniqueId . / . $this->action->id; ?>
我想知道这个$this是哪来的?这也没有类啊!
注释里面不是写了吗?
$this DefaultController
Yii view 里面的$this 是指当前controller,具体过程去看conroller的render方法.
因为是用Yii自身的renderer,所以调用的是ViewRenderer类的renderFile方法,
这方法接收一个$context参数,其实传的就是当前controller的实例对象,
然后再调这个controller的renderInternal方法,这个方法把view文件require进来了,
所以在view的$this其实是把当前controller传进来,然后调用传进来的controller的自身方法,把view文件require进来.
用debug_print_backtrace
一看就知道
我心里有答案,但没实际用过YII,所以就只说方法了