在PHP 0777中0是必要的吗?

时间:2021-12-13 12:31:16
mkdir("/path/to/my/dir", 0700);

Is the 0 in 0777 necessary?

0777中的0是必需的吗?

3 个解决方案

#1


11  

Yes. The leading zero will make the number interpreted as octal number; without it would be interpreted as decimal number.

是的。前导零将数字解释为八进制数;没有它,将被解释为十进制数。

var_dump(0700); // int(448)
var_dump(700);  // int(700)

#2


4  

The leading zero indicates an octal value. See also the documentation of chmod.

前导0表示八进制的值。参见chmod的文档。

#3


3  

Yes. It's an octal literal

是的。这是一个八进制文字

#1


11  

Yes. The leading zero will make the number interpreted as octal number; without it would be interpreted as decimal number.

是的。前导零将数字解释为八进制数;没有它,将被解释为十进制数。

var_dump(0700); // int(448)
var_dump(700);  // int(700)

#2


4  

The leading zero indicates an octal value. See also the documentation of chmod.

前导0表示八进制的值。参见chmod的文档。

#3


3  

Yes. It's an octal literal

是的。这是一个八进制文字