(PHP 5 >= 5.1.2, PHP 7, PHP 8)
SplFileInfo::getOwner — 获取文件的拥有者
此函数没有参数。
成功时返回数字格式的拥有者ID,失败时返回false。
错误时抛出RuntimeException异常。
示例 #1 SplFileInfo::getOwner() 示例
<?php
$info = new SplFileInfo('example.jpg');
echo info->getFilename() . ' belongs to owner id ' . $info->getOwner() . "\n";
print_r(posix_getpwuid($info->getOwner()));
?>以上示例将输出类似以下内容
example.jpg belongs to user id 501
Array
(
[name] => tom
[passwd] => x
[uid] => 501
[gid] => 42
[gecos] => Tom Cat
[dir] => /home/tom
[shell] => /bin/bash
)