This article brings you the content is about how PHP through the path to get the file name (code), there is a certain reference value, the need for friends can refer to, I hope to help you.
Definition of a class constant
A constant defined inside a class.
Class constants must be defined with the Const keyword
Const constant NAME = value;
The relationship of constants to objects
Constants cannot be accessed through objects
access to class constants
A class constant belongs to a class and not to an object. object is not accessible to class constants.
Constant access must be achieved through the class:
Class Name:: Constant Name
:: Called Range resolution operator
There is a constant use of classes within the class to access the members of the class, when the class is accessed internally using the class, there is a keyword similar to $this that represents the object: self, its own meaning, represents the current class name
<?phpclass person () { const haoyun= ' PHP software Development Engineer ';} Get $person=new person () from outside the class, echo $person->haoyun;echo Haoyun;echo person::haoyun;//class internal get