Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
439 views
in Technique[技术] by (71.8m points)

zend framework - What do two colons mean in PHP?

I don't know what it's doing when we have this situation:

Foo::Bar

It looks like a path.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The :: operator is the scope resolution operator. It is used to access class constants or static properties and methods, either from outside the class:

ClassName::CONSTANT_VALUE
ClassName::staticMethod()

Or within a class method to reference the same or a parent class using self and parent:

self::CONSTANT_VALUE
self::staticMethod()
parent::CONSTANT_VALUE
parent::staticMethod()

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...