readfile() 函数读取文件,并把它写入输出缓冲。(如读取成功则返回字节数)
$dir=’../ test /test.txt’;
echo readfile($dir);
fopen( filename,mode,include_path,context ) 如果打开失败,本函数返回 FALSE。文件不存在,mode为w/a类的参数则新建文件。
fread( file ,length )
$file = fopen(“test.txt”,”r”);
fread($file,filesize(“test.txt”));//读取所有
fgets ( file,[length] ) //函数从文件指针中读取一行。
is_file( file ) 如果文件存在且为正常的文件,则返回 true。
fclose ( file ) 函数用于关闭打开的文件。
unlink() //删除文件,成功返回true
f EOF () //函数检测是否已到达文件末尾 (eof)。
如果文件指针到了 EOF 或者出错时则返回 TRUE,否则返回一个错误(包括 Socket 超时),其它情况则返回 FALSE。
fwrite( file,string,length ) //函数写入文件
touch ( filename,time,atime )
函数设置指定文件的访问和修改时间。如果文件不存在,则会被创建。默认是当前系统时间。
copy( source,destination ) 将文件从 source 拷贝到 destination。如果成功则返回 TRUE,否则返回 FALSE。
如:copy(“1.txt”,”2.txt”);
disk_free_space( directory ) 函数返回目录中的可用空间
disk_total_space( directory ) 函数返回指定目录的磁盘总大小。
disk_total_space( “C:” ) ;
如:echo disk_total_space(‘F:’); //118008057856
fsockopen() 函数比fopen()函数的优点:fopen()只会在PHP中已经将allow_url_fopen设置为真时才能使用,而fsockopen()并没有限制。
Socket可以理解为两台计算机相互通信的通道。
fsockopen( $host, [$port, $error_no, $error_desc, 30] )
URL、端口号、存放错误编号的变量、存放错误信息字符串的变量,超时等待时间