What does $this mean in thinkphp
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>
Current object reference
This object, $a = new Name(); $a->fun this is the object $a
$this is this object,