$ this实际意味着什么> Codeigniter [英] What does $this actually mean> Codeigniter

查看:112
本文介绍了$ this实际意味着什么> Codeigniter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

愚蠢的问题我知道,

在所有教程中,他们不解释为什么他们使用$ this。

From all the tutorials they do not explain why they use $this.

是$这是一个来自Codeigniter基类的对象吗?

Is $this like an object from a base class in Codeigniter?

欢迎任何解释! :)

感谢

推荐答案

/ strong>你的问题, $ this 实际上代表单例的Codeigniter实例(实际上是控制器对象)。

To actually answer your question, $this actually represents the singleton Codeigniter instance (which is actually the controller object).

例如,当您加载库/模型时,您将它们附加到此实例,以便您可以将它们作为此实例的属性来引用。

For example when you load libraries/models, you're attaching them to this instance so you can reference them as a property of this instance.

另一种获取方法codeigniter中的实例是在构建可移植库时使用的 get_instance()函数。

Another way to get this instance in codeigniter is the get_instance() function that you use when building portable libraries.

这篇关于$ this实际意味着什么> Codeigniter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆