What does $this actually mean> Codeigniter

后端 未结 6 861
攒了一身酷
攒了一身酷 2020-12-09 11:25

Silly question I know,

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

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

Any e

6条回答
  •  情书的邮戳
    2020-12-09 12:01

    It is the way to reference an instance of a class from within itself, the same as many other object oriented languages. From the PHP docs: The pseudo-variable $this is available when a method is called from within an object context. ... $this is mainly used to refer properties of a class

提交回复
热议问题