文件属性:
文件所有者: fileowner(文件名)
文件大小(Byte): filesize(文件名)
文件类型: filetype(文件名)
File information functions | |
Function name | What file information does the function provide? |
file_exists( ) | Does the file exist? |
fileatime( ) | Last access time |
filectime( ) | Last metadata change time |
filegroup( ) | Group (numeric) |
fileinode( ) | Inode number |
filemtime( ) | Last change time of contents |
fileowner( ) | Owner (numeric) |
fileperms( ) | Permissions (decimal, numeric) |
filesize( ) | Size |
filetype( ) | Type (fifo, char, dir, block, link, file, unknown) |
is_dir( ) | Is it a directory? |
is_executable( ) | Is it executable? |
is_file( ) | Is it a regular file? |
is_link( ) | Is it a symbolic link? |
is_readable( ) | Is it readable? |
is_writable( ) | Is it writeable? |
――――――――――――――――――――――――――――――――――――
文件本身就是一个数组
$myFile = file("data.txt");
通过file()函数将文件转换为一个字符串数组
<HTML>
<HEAD>
<TITLE>调用文本文件内容</TITLE>
</HEAD>
<BODY>
<CENTER>
<?
// 打开文件同时,打印每一行
$myFile = file( "data.txt");
//得到字符串数组,每一行为数组的一个元素
for($index = 0; $index < count($myFile); $index++)
{
print($myFile[$index]."<BR>");
}
?>
</CENTER>
</BODY>
</HTML>