Php magic constants and instance code, and magic Constants

Source: Internet
Author: User

Php magic constants and instance code, and magic Constants

Php magic Constants

Instance:

Class MoShu {public function moshu () {echo 'current class Name :'. _ CLASS __. "<br/>"; echo 'current Method Name :'. _ FUNCTION __. "<br/>"; echo 'number of lines 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: D: \ xampp \ htdocs \ test. The returned class name is MoShu: moshu.

Thank you for reading this article. I hope it will help you. Thank you for your support for this site!

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.