Home > Backend Development > PHP Tutorial > What does $this in thinkphp mean?

What does $this in thinkphp mean?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-08-04 09:20:15
Original
1880 people have browsed it

What does $this mean in thinkphp

Reply content:

What does $this mean in thinkphp

$this is the current object reference, which is from PHP and has nothing to do with thinkphp

represents the current object, which has different meanings in different places. It depends on the specific code. Also +1 for upstairs

$this must be a PHP keyword that appears inside the class class, indicating the current object. Generally, the current class calls its own properties and methods.

<code><?php
class demo
{
    public $name;
    
    public function __construct($name='')
    {
        $this->name = $name;  //这里的$this 就是当前对象,就是本身的属性 赋值
    }

}
</code>
Copy after login

Current object reference

This object, $a = new Name(); $a->fun this is the object $a

$this is this object,

Related labels:
php
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template