echo __FILE__; //输出文件的完整路径和文件名。 如:D:\PHPnow\htdocs\new\test.php
echo __LINE__; //输出文件中的当前行号 //此时为 5
function testfunctionname(){
echo __FUNCTION__; //输出本函数在定义时的函数名 此时为 : testfunctionname
}
//testfunctionname();
class testclassname{
function testclassname(){
echo __CLASS__; //输出该类在定义时的类名 此时为 : testclassname
}
}
//new testclassname;
class testmethodname{
function testmethod(){
//echo __FUNCTION__; //输出该函数在定义时的函数名 此时为 : testmethod
echo __METHOD__; //输出该方法在定义时的方法名 此时为 : testmethodname::testmethod
}
}
$tmn=new testmethodname; //实例化类 testmethodname
$tmn -> testmethod(); //调用tmn该实例化对应的类的方法
//testmethodname::testmethod(); //无需实例化,直接调用testmethodname类下的方法
testmethod();
?>