Determine file type
Var_dump (FileType ("./img")); Returns the file type, directory, or file Var_dump (Is_dir ("./img/11.png")); Determine if the given file is not a directory is_file (); Determine whether the given file is not a file
File properties
Var_dump (Date ("Y-m-d h:i:s", Fileatime ("./img/11.png")); File last access Time Var_dump (date ("Y-m-d h:i:s", Filemtime ("./img/11.png")); File modification time echo filesize ("./img/11.png"); File size Filectime ("")//File creation time file_exists ("")//File exists
File path
/on behalf of the root Web page inside represents the WWW directory PHP inside represents the disk root var_dump (file_exists ("/wamp/www/1220/wenjian/img/11.png"));//File Presence echo $_ server[' Document_root ']; Fetch the server root path echo basename ("/wamp/www/1220/wenjian/img/11.png"); Gets the file name in the path echo dirname ("/wamp/www/1220/wenjian/img/11.png"); Directory name Var_dump in the path (PathInfo ("/wamp/www/1220/wenjian/img/11.png")); Returns the array echo Realpath ("./img/11.png");//convert relative path to absolute path
Traverse Directory
Var_dump (Glob ("./ajax/*")); Returns an array of all files in this directory
Give me a folder that returns the number of files in that folder
function Shuliang ($url) { $SL = 0; $arr = Glob ($url); foreach ($arr as $v) { if (Is_file ($v)) { $sl + +; } else { $SL + = Shuliang ($v. " /*"); } } return $SL;} Echo Shuliang ("./ajax/*");