都從 php.net 複制過來,只是記錄一下,
老了,常會忘掉,這樣下次就不用再查了
glob : Find pathnames matching a pattern
http://php.net/manual/en/function.glob.php
print_r(glob("*.txt"));Output ......
Array( [0] => target.txt [1] => source.txt [2] => test.txt [3] => test2.txt )
pathinfo : Returns information about a file path
http://php.net/manual/en/function.pathinfo.php
print_r(pathinfo("/testweb/test.txt"));Output ......
Array( [dirname] => /testweb [basename] => test.txt [extension] => txt )
is_dir : Tells whether the filename is a directory
http://www.w3school.com.cn/php/func_filesystem_is_dir.asp
$file = "images"; if (is_dir($file)) { echo ("$file is a directory"); } else { echo ("$file is not a directory"); }Output ......
images is a directory
filesize : Gets file size
http://php.net/manual/en/function.filesize.php
echo filesize("test.txt");Output ......
245
0 comments:
張貼留言