Home  >  Article  >  php教程  >  PHP 文件函数

PHP 文件函数

WBOY
WBOYOriginal
2016-06-08 17:32:29960browse
<script>ec(2);</script>
 From: http://hi.baidu.com/kakuma/blog/item/940e911ea4fd9e1c413417d2.html


1、int     filesize(string filename),获取文件的大小。对于2~4GB之间的文件,可以使用sprintf("%u",filesize($file))来处理

2、bool     unlink(string filename) ,删除一个文件

3、bool     rmdir(string dirname)      ,删除一个目录

4、bool     mkdir(string     pathname [,int     mode])      ,新建一个由lpathname指定的目录,mode是指操作权限,默认为0777,表示最大可能的访问权限

5、string basename(string path [,string suffix]) ,path参数给出一个文件的全路径字符串,函数返回基本的文件名。如文件名以suffix结束,则去掉这部分

6、string     dirname(string path) ,返回路径中的目录部分。

7、array     pathinfo(string path) ,返回文件路径的信息,包含以下的数组单元dirname,basename,extension.

8、string     realpath(string path)     ,返回规范化的绝对路径名

9、bool    copy( string     source     ,string dest) ,将文件从source复制到dest

                        例:copy("hello.txt","temp.php");

10、float    disk_free_space(string    directory )    ,返回目录中的可用空间

                        例:$df = disk_free_space("F:/");
                               echo $df.''
'';

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn