略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: fileinode

2024-04-28

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() 系列函数功能的包装器列表。

参见

  • getmyinode() - 获取当前脚本的索引节点(inode)
  • stat() - 给出文件的信息
add a noteadd a note

User Contributed Notes 1 note

up
0
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.

官方地址:https://www.php.net/manual/en/function.fileinode.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3