php将fileterms函数返回的结果变成可读的形式
作者:bea
代码如下: function perms_str($perms){ if (($perms & 0xC000) == 0xC000) { // Socket $info = 's'; } elseif (($perms & 0xA000) == 0xA000) { // Symbolic Link $info = 'l'; } elseif (($perms & 0x8000) == 0x
代码如下:
function perms_str($perms){
if (($perms & 0xC000) == 0xC000) {
// Socket
$info = 's';
} elseif (($perms & 0xA000) == 0xA000) {
// Symbolic Link
$info = 'l';
} elseif (($perms & 0x8000) == 0x8000) {
// Regular
$info = '-';
} elseif (($perms & 0x6000) == 0x6000) {
// Block special
$info = 'b';
} elseif (($perms & 0x4000) == 0x4000) {
// Directory
$info = 'd';
} elseif (($perms & 0x2000) == 0x2000) {
// Character special
$info = 'c';
} elseif (($perms & 0x1000) == 0x1000) {
// FIFO pipe
$info = 'p';
} else {
// Unknown
$info = 'u';
}
// Owner
$info .= (($perms & 0x0100) ? 'r' : '-');
$info .= (($perms & 0x0080) ? 'w' : '-');
$info .= (($perms & 0x0040) ?
(($perms & 0x0800) ? 's' : 'x' ) :
(($perms & 0x0800) ? 'S' : '-'));
// Group
$info .= (($perms & 0x0020) ? 'r' : '-');
$info .= (($perms & 0x0010) ? 'w' : '-');
$info .= (($perms & 0x0008) ?
(($perms & 0x0400) ? 's' : 'x' ) :
(($perms & 0x0400) ? 'S' : '-'));
// World
$info .= (($perms & 0x0004) ? 'r' : '-');
$info .= (($perms & 0x0002) ? 'w' : '-');
$info .= (($perms & 0x0001) ?
(($perms & 0x0200) ? 't' : 'x' ) :
(($perms & 0x0200) ? 'T' : '-'));
return $info;
}
有用 | 无用
猜你喜欢
您可能感兴趣的文章:
- php debug 安装技巧
- vs中通过剪切板循环来循环粘贴不同内容
- php获取mysql数据库中的所有表名的代码
- 使用GROUP BY的时候如何统计记录条数 COUNT(*) DISTINCT
- mysql_num_rows VS COUNT 效率问题分析
- fleaphp rolesNameField bug解决方法
- FirePHP 推荐一款PHP调试工具
- 在smarty模板中使用PHP函数的方法
- 对text数据类型不支持代码页转换 从: 1252 到: 936
- fleaphp crud操作之find函数的使用方法
- fleaphp crud操作之findByField函数的使用方法
- fleaphp常用方法分页之Pager使用方法
- PHP中限制IP段访问、禁止IP提交表单的代码
- PHP计划任务、定时执行任务的实现代码
- PHP导入Excel到MySQL的方法
- 在php和MySql中计算时间差的方法
- PHP遍历二维数组的代码
- PHP中调用ASP.NET的WebService的代码
- php中利用post传递字符串重定向的实现代码