如何在php中确定文件是否具有硬链接
我想用PHP获取文件的链接硬链接数(与如何在php中确定文件是否具有硬链接,php,Php,我想用PHP获取文件的链接硬链接数(与ls-l中的结果相同) 例如: ls -l file1 -rw-rw-r--. 1 lilo lilo 0 Feb 26 07:08 file1 ^ 如何获取这些数据 提前感谢。使用stat()功能: <?php $filestat = stat('/path/to/file'); echo 'Number of links to file: '.$filestat['nlink']; ?> 可以在中找到所有数组
ls-l
中的结果相同)
例如:
ls -l file1
-rw-rw-r--. 1 lilo lilo 0 Feb 26 07:08 file1
^
如何获取这些数据
提前感谢。使用stat()
功能:
<?php
$filestat = stat('/path/to/file');
echo 'Number of links to file: '.$filestat['nlink'];
?>
可以在中找到所有数组成员的列表。使用stat()
函数:
<?php
$filestat = stat('/path/to/file');
echo 'Number of links to file: '.$filestat['nlink'];
?>
可以在中找到所有数组成员stat()
检索的列表