PHP chmod() 函数
实例
更改 "test.txt" 文件的权限:
<?php
// Read and write for owner, nothing for everybody else
chmod("test.txt",0600);
// Read and write for owner, read for everybody else
chmod("test.txt",0644);
// Everything for owner, read and execute for everybody else
chmod("test.txt",0755);
// Everything for owner, read for owner's group
chmod("test.txt",0740);
?>
// Read and write for owner, nothing for everybody else
chmod("test.txt",0600);
// Read and write for owner, read for everybody else
chmod("test.txt",0644);
// Everything for owner, read and execute for everybody else
chmod("test.txt",0755);
// Everything for owner, read for owner's group
chmod("test.txt",0740);
?>
定义和用法
chmod() 函数改变文件模式。
如果成功则返回 TRUE,否则返回 FALSE。
语法
chmod(file, mode)
参数值
参数 | 描述 |
---|---|
file | 必需。规定要检查的文件。 |
mode |
可选。规定新的权限。 mode 参数由 4 个数字组成:
可能的值(如需设置多个权限,请对下面的数字进行总计):
|
技术细节
返回值: | 成功为 TRUE,失败为 FALSE |
---|---|
PHP 版本: | 4.0+ |