Php magic constant test example

Source: Internet
Author: User

Php magic constant test example

Directly paste the test code:

The Code is as follows:  

Class MoShu {
Public function moshu (){
Echo 'current CLASS Name: '. _ CLASS _. "<br/> ";
Echo 'current Method Name: '. _ FUNCTION _. "<br/> ";
Echo 'the number of rows in the current file: '. _ LINE _. "<br/> ";
Echo 'absolute path of the current FILE: '. _ FILE _. "<br/> ";
Echo 'Folder of the absolute path of the current file: '. _ DIR _. "<br/> ";
Echo 'Return Class Name: METHOD Name: '. _ METHOD _. "<br/> ";
}
}


$ Moshu = new moshu ();
$ Moshu-> moshu ();

The result is as follows:

Current Class Name: MoShu
Current Method Name: moshu
Number of lines in the current file: 10
Absolute path of the current file: D: \ xampp \ htdocs \ test \ moshu. php
Folder in the absolute path of the current file: D: \ xampp \ htdocs \ test
Returned Class Name: Method Name: MoShu: moshu
Current Class Name: MoShu
Current Method Name: moshu
Number of lines in the current file: 10
Absolute path of the current file: D: \ xampp \ htdocs \ test \ moshu. php
Folder in the absolute path of the current file: D: \ xampp \ htdocs \ test
Returned Class Name: Method Name: MoShu: moshu

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.