Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/270.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
用php读取类CHMOD值_Php_Function_Terminology_Chmod - Fatal编程技术网

用php读取类CHMOD值

用php读取类CHMOD值,php,function,terminology,chmod,Php,Function,Terminology,Chmod,我喜欢这样一种模式,您可以将选项的任意组合存储在一个整数中,并通过将最后的数字8、16、32等加倍来添加选项。 我想使用这个方法,我想知道它是否有一个名字,什么是最快最简单的方法来将数字转换成类似的结果 # Permission 7 read and write and execute (1+2+4) 6 read and write (2+4) 5 read and execute (1+4) 4 read only 3 write and execute (1+2)

我喜欢这样一种模式,您可以将选项的任意组合存储在一个整数中,并通过将最后的数字8、16、32等加倍来添加选项。 我想使用这个方法,我想知道它是否有一个名字,什么是最快最简单的方法来将数字转换成类似的结果

#   Permission
7   read and write and execute (1+2+4)
6   read and write (2+4)
5   read and execute (1+4)
4   read only 
3   write and execute (1+2)
2   write only
1   execute only 
0   none

这通常称为a,您可以使用。

这通常称为a,您可以使用。

此方法称为,并在类似php的应用程序中使用。这是一个很好的方法。

这种方法被称为,并在类似php的应用程序中使用。下面是一个很好的方法。

按照建议使用位操作。以获取您要查找的阵列

此函数将计算出给定值所需的位数,并以您建议的格式返回数组

我已经包含了一个0到20的循环来验证

array(1=>false,2=>true,4=>true);//6
array(1=>true,2=>true,4=>true,8=>true);//15

按建议使用位操作。以获取您要查找的阵列

此函数将计算出给定值所需的位数,并以您建议的格式返回数组

我已经包含了一个0到20的循环来验证

array(1=>false,2=>true,4=>true);//6
array(1=>true,2=>true,4=>true,8=>true);//15
相关rant:相关rant: