fileinode
(PHP 4, PHP 5, PHP 7, PHP 8)
fileinode — 取得文件的 inode
说明
fileinode(string
$filename
): int取得文件的 inode。
参数
-
filename
-
文件的路径。
返回值
返回文件的 inode 节点号, 或者在失败时返回 false
。
范例
示例 #1 将某个文件和当前文件的 inode 进行对比
<?php
$filename = 'index.php';
if (getmyinode() == fileinode($filename)) {
echo 'You are checking the current file.';
}
?>
错误/异常
失败时抛出E_WARNING
警告。
注释
注意: 此函数的结果会被缓存。参见 clearstatcache() 以获得更多细节。
小技巧
自 PHP 5.0.0 起, 此函数也用于某些 URL 包装器。请参见 支持的协议和封装协议以获得支持 stat() 系列函数功能的包装器列表。

User Contributed Notes 1 note
sofe2038 at gmail dot com ¶
1 year ago
As documented in https://www.php.net/manual/en/function.stat.php#refsect1-function.stat-returnvalues:
> On Windows, as of PHP 7.4.0, this is the identifier associated with the file, which is a 64-bit unsigned integer, so may overflow. Previously, it was always 0.
It appears that fileinode shares the same underlying implementation.