pathinfo () functionDefinition and usage
The PathInfo () function returns information about the file path in the form of an array.
The returned array elements are as follows:
- [DirName]
- [BaseName]
- [Extension]
Http://www.runoob.com/php/func-filesystem-pathinfo.html
basename () function
Http://www.runoob.com/php/func-filesystem-basename.html
The basename () function returns the file name portion of the path.
Instance
1<?PHP2 $path= "/testweb/home.php";3 4 //Show filename with file extension5 Echo basename($path) ." <br/> ";6 7 //Show filename without file extension8 Echo basename($path, ". PHP");9?>
The above code will output:
home.php
Home
filesize () functionDefinition and usage
The FileSize () function returns the size of the specified file.
If successful, the function returns the number of bytes in the file size. If it fails, it returns FALSE.
Grammar
filesize(filename)
Http://www.runoob.com/php/func-filesystem-filesize.html
Php_eol
Line break
UNIX series with \ n
Windows series with \ r \ n
Mac with \ r
PHP can be replaced with Php_eol to improve code-level portability
1 <? PHP 2 Echo Php_eol ; 3 // the Windows platform is equivalent to echo "\ r \ n"; 4 //unix\linux platform equivalent to echo "\ n"; 5 //mac platform equivalent to echo "\ r";
get_defined_constants()返回所有常量数组
Similar to what is commonly used
Directory_separator
You can use the function get_defined_constants () to get all the PHP constants
1 <? PHP 2 Print_r (get_defined_constants()); // get_defined_constants () returns all constant arrays
PHP Common functions