PHP magic constant & lt ;? Php & nbsp;/***** & nbsp; & nbsp; public welfare PHP Lecture Hall & nbsp; altar: & nbsp; http://www.zixue.it & nbsp; Micro & nbsp; blog: & nbsp; http: // w PHP magic constant
- /****
- Yan 18 public welfare PHP Lecture Hall
-
- Discussion: http://www.zixue.it
- Micro Bo: http://weibo.com/Yshiba
- YY Channel: 88354001
- ****/
- /***
- === Note ====
- Magic constant
-
- 1: The value cannot be manually modified, so it is called a constant.
- 2: But the value changes with the environment, so it is called Magic
-
- --- Magic constant
- _ FILE _ return the path of the current FILE.
- Used to calculate the root directory of a website in framework development or website initialization scripts
-
- _ LINE _ returns the current row number.
- In the framework, it can be used to record error information during debugging.
-
-
-
- _ CLASS _ returns the current CLASS name
-
- _ METHOD _ returns the current METHOD name.
- ***/
- Echo 'the currently running is ',__ FILE __, 'file ',' ';
- Echo 'current in ',__ DIR __,' Directory ';
- Echo 'Hi, I am at ',__ LINE __,' ';
- Echo 'hello, I am at ',__ LINE __,' ';
- Echo 'Hehe, I am at ',__ LINE __,' ';
- Class Human {
- Public static function t (){
- Echo 'You are running ',__ CLASS __,' CLASS ';
- Echo ',__ METHOD __, 'method ';
- }
- }
- Human: t ();