__FILE__:返回所在路径文件名和文件名称

__DIR__:返回文件所在的完整目录

__LINE__:返回当前文件代码的行号

__CLASS__:返回当前类名

__FUNCTION__:返回当前方法名

__METHOD__:返回当前类名和方法名

 

var_dump(__FILE__); //所在路径文件名和文件名称      E:\demo\blog_code\predefined\predefined.php
var_dump(__DIR__);  //所在完整目录                 E:\demo\blog_code\predefined
var_dump(__LINE__); //代码所在行号                 4
class testClass{
    function testMethod(){
        var_dump(__FUNCTION__);  //返回当前方法名   testMethod
        var_dump(__CLASS__);    //返回类名          testClass
        var_dump(__METHOD__);   //类名加方法名      testClass::testMethod
    }
}

$a=new testClass();
$a->testMethod();

  

相关文章:

  • 2021-07-30
  • 2021-08-12
  • 2022-12-23
  • 2021-05-24
  • 2021-11-02
  • 2022-12-23
  • 2021-09-18
  • 2021-08-20
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-13
  • 2021-05-16
  • 2021-05-18
  • 2021-05-18
  • 2021-06-17
相关资源
相似解决方案