我们在哪里使用对象运算符“-".在PHP中? [英] Where do we use the object operator "->" in PHP?
本文介绍了我们在哪里使用对象运算符“-".在PHP中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在PHP中可以使用对象运算符->
的不同方式有哪些?
What are the different ways where we can use object operators ->
in PHP?
推荐答案
PHP有两个对象运算符.
PHP has two object operators.
如果要在实例上调用方法或访问实例属性,则使用第一个->
.
The first, ->
, is used when you want to call a method on an instance or access an instance property.
第二个 ::
是当您要调用 static
方法时使用static
变量,或在子类中调用方法的父类版本.
The second, ::
, is used when you want to call a static
method, access a static
variable, or call a parent class's version of a method within a child class.
这篇关于我们在哪里使用对象运算符“-".在PHP中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文