$ this在PHP中是什么意思? [英] What does $this mean in PHP?
本文介绍了$ this在PHP中是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能重复:
PHP:self vs this
Possible Duplicate:
PHP: self vs this
你好,
您能帮我理解PHP变量名称$this
的含义吗?
Hello,
Could you help me understanding the meaning of the PHP variable name $this
?
谢谢您的帮助.
推荐答案
$this
是指您所在的班级.
例如
Class Car {
function test() {
return "Test function called";
}
function another_test() {
echo $this->test(); // This will echo "Test function called";
}
}
希望这会有所帮助.
这篇关于$ this在PHP中是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文