The time () function returns the number of seconds from 1970-1-1 0:0:0 to the current. (Integral type)
DirName (__file__)
A useful constant is defined in PHP, which is
__file__
The default constant is the full path (path + filename) of the current PHP program.
Even if the file is referenced by another file (include or require), __file__ is always the full path to the file it resides in, not the full path to the file that references it.
Take a look at the following example:
/home/data/demo/test/a.php
<?php
$the _full_name=__file__;
$the _dir=dirname (__file__);
echo $the _full_name; Back to/home/data/demo/test/a.php
echo $the _dir; Back to/home/data/demo/test
?>
home/data/demo/b.php
<?php include "test/a.php";
echo $the _full_name; Back to/home/data/demo/
echo $the _dir; Return/home/data/demo/test instead of/home/data/demo/
>test/a.php, not/home/data/demo/b.php.
To put it simply:
__FILE__ returns the current path + file name
DirName (__file__) returns the path portion of the current file path
DirName (DirName (__file__)); Gets the file on the top of the directory name (does not include the last "/" number)
For example, if the current file is/home/data/demo/test.php, the
__FILE__ get is the full path is/home/data/demo/test.php, and
DirName (__file__) Gets the path part that is the/home/data/demo (no "/" number behind)
Time () function, summary of Use of dirname (__file__)