Definition and Usage
定义和用法
The chmod() function changes permissions of the specified
file.
chmod()函数的作用是:改变指定文件的模式。
Returns TRUE on success and FALSE on
failure.
函数执行成功返回True,执行失败返回False。
Syntax
语法
chmod(file,mode) |
| Parameter 参数 | Description 描述 |
|---|---|
| file | Required. Specifies the file to check 必要参数。指定文件对象 |
| mode | Required. Specifies the new
permissions. 必要参数。指定新的特许[permission]: The mode parameter consists of four numbers: Mode[模式]参数有四个数字组成:
Possible values (to set multiple permissions, add up the following
numbers):
|
Example
案例
<?php// Read and write for owner, nothing for everybody elsechmod("test.txt","0600");
// Read and write for owner, read for everybody elsechmod("test.txt","0644");
// Everything for owner, read and execute for everybody elsechmod("test.txt","0755");
// Everything for owner, read for owner's groupchmod("test.txt","0740");?>
|
本文详细介绍了 PHP 中的 chmod 函数,该函数用于更改指定文件的权限。文章解释了如何通过不同的数字组合来设定所有者、用户组和其他用户的读、写、执行权限,并提供了具体的示例。
990

被折叠的 条评论
为什么被折叠?



