1. Get the constant of the row number, file path file name, class name, and method name.
The current row number in the _ line _ file.
The complete path and file name of the _ file. If it is used in a include file, the include file name is returned. Starting from PhP 4.0.2, __file _ always contains an absolute path, while earlier versions sometimes contain a relative path.
_ Class name (New in PHP 4.3.0 ). Starting from PHP 5, this constant returns the name (case sensitive) when the class is defined ). In PHP 4, the value is always lowercase letters.
_ Method _ class method name (New PHP 5.0.0) (including class name ). Returns the name (case sensitive) when the method is defined ).
_ Function name (New in PHP 4.3.0) (excluding the class name ). Starting from PHP 5, this constant returns the name (case sensitive) when the function is defined ). In PHP 4, the value is always lowercase letters.
Note: These constants have two underscores.
2. Methods for obtaining class name, method name, and variable name
One of the advantages of PHP is that unexpected functions or constants often help you easily complete some functions. I am more and more familiar with why there are so many questions about specific PHP functions in the PHP comparison questions.
I found some other constants or functions in one breath and added them continuously.
Get_class (Class Name); // obtain the Class Name of the class where the current statement is located.
Get_class_methods (Class Name); // Retrieves all the method names of the Class Name and forms an array
Get_class_vars (Class Name); // Retrieves all the highlighted names of the Class Name and forms an array