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!