PHP预定义常量

走了点弯路,原来可以这么简单就做到,参阅PHP预定义常量
[code] class test {
function test_function() {
return __FUNCTION__;
}
function test_class() {
return __CLASS__;
}
function test_method() {
return __METHOD__;
}
}

echo "当前行号: ".__LINE__."
“;
echo “当前文件的完整路径: “.__FILE__.”
“;
echo “当前执行的类: “.test::test_class().”
“;
echo “当前执行的函数: “.test::test_function().”
“;
echo “当前类的方法名: “.test::test_method().”
“;
?>[/code]
输出结果:

当前行号: 14
当前文件的完整路径: E:\item_1\webmaster\test.php
当前执行的类: test
当前执行的函数: test_function
当前类的方法名: test::test_method

2 Responses to “PHP预定义常量”

  1. alonefly Says:

    报告。你这里被挂马了。

  2. hehe Says:

    keyi

发页文章评论

Theme Brought to you by Directory Journal and Elegant Directory