This article mainly talks about the magic constants _FILE_, _LINE_, __FUNCTION__. Students in need can refer to a simple and practical example.
Name
Description
_FILE_
Current file name
_LINE_
Current line number
_FUNCTION_
Current function name
_CLASS_
Current class name
_METHOD_
Current method name
The so-called magic constants are not real constants, but variables that obtain fixed values according to the situation
The code is as follows
代码如下 |
复制代码 |
echo __FILE__;
echo ' ';
echo __LINE__;
echo ' ';
function funcTest()
{
echo __FUNCTION__;
}
funcTest();
?>
output
D:AppServwwwBasic7demo15.php
5
funcTest
|
|
Copy code |
|
echo __FILE__;
echo '
';
echo __LINE__;
echo '
';
function funcTest()
{
echo __FUNCTION__;
}funcTest();
?>
output
D:AppServwwwBasic7demo15.php
5
funcTest
http://www.bkjia.com/PHPjc/631294.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/631294.htmlTechArticleThis article mainly talks about the magic constants _FILE_, _LINE_, __FUNCTION__. Students in need can refer to the simple A practical example. Name Description _FILE_ Current file name _LI...