900字范文,内容丰富有趣,生活中的好帮手!
900字范文 > YII框架这段代码是啥意思?是moudles里面view中default中的index.SegmentFault

YII框架这段代码是啥意思?是moudles里面view中default中的index.SegmentFault

时间:2018-07-11 16:40:15

相关推荐

YII框架这段代码是啥意思?是moudles里面view中default中的index.SegmentFault

后端开发|php教程

php,yii

后端开发-php教程

易语言云盘源码,ubuntu开机没页面,学python爬虫就业,质数 php,辽宁网站seolzw

breadcrumbs=array( $this->module->id,);?>

uniqueId . / . $this->action->id; ?>

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是个什么东西lzw

我想知道这个$this是哪来的?这也没有类啊!

回复内容:

breadcrumbs=array( $this->module->id,);?>

uniqueId . / . $this->action->id; ?>

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 editing

我想知道这个$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,所以就只说方法了

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。