Filesystem 函数
在线手册:中文  英文

fileinode

(PHP 4, PHP 5)

fileinode取得文件的 inode

说明

int fileinode ( string $filename )

取得文件的 inode。

参数

filename

文件的路径。

返回值

返回文件的 inode 节点号, 或者在失败时返回 FALSE

范例

Example #1 将某个文件和当前文件的 inode 进行对比

<?php
$filename 
'index.php';
if (
getmyinode() == fileinode($filename)) {
    echo 
'You are checking the current file.';
}
?>

错误/异常

失败时抛出E_WARNING警告。

注释

Note: 此函数的结果会被缓存。参见 clearstatcache() 以获得更多细节。

Tip

自 PHP 5.0.0 起, 此函数也用于某些 URL 包装器。请参见 支持的协议和封装协议以获得支持 stat() 系列函数功能的包装器列表。

参见


Filesystem 函数
在线手册:中文  英文

用户评论:

meltir at meltir dot com dot nothing (2007-11-26 01:02:28)

keep in mind that this function is prone to an overflow, and on big filesystems it will return negative values.

pixel20 at wp dot pl (2007-10-04 12:48:59)

Sample function that generates apache 2.2 ETag. Useful for scripts serving images or other cachable data.
$file="example.png";
// Inode
$ETag = dechex(fileinode($file));
// Size
$ETag.= "-".dechex(filesize($file));
// Modification time in useconds & (2^33-1)
$ETag.= "-".dechex(((filemtime($file).str_repeat("0",6)+0) & (8589934591)));
header("ETag: \"$ETag\");

mark nearby techexplained dot com (2005-01-06 09:37:52)

This function, in spite of its name, also works for directories. Most any valid path in the filesystem will generate an inode value.

易百教程