当前位置: 首页 > 网络学院 > 服务端脚本教程 > PHP > chmod() 函数

PHP
php 无限分类的实现
常用PHP代码
windows下安装配置php视频教程
MySQL数据库结构和数据的导出和导入
PHP实现 IP Whois 查询
PHP5 this,self和parent关键字详解
PHP 安全技巧连载 #1[译]
PHP 安全技巧连载 #2[译]
PHP 安全技巧连载 #3[译]
PHP 安全技巧连载 #4[译]
PHP 安全技巧连载 #5[译]
PHP 安全技巧连载 #6[译]
PHP 安全技巧连载 #7[译]
PHP 安全技巧连载 #8[译]
PHP 安全技巧连载 #9[译]
PHP 安全技巧连载 #10[译]
PHP 安全技巧连载 #11[译]
PHP error_reporting的使用
PHP 安全技巧连载 #12
使用PHP做Linux/Unix守护进程

PHP 中的 chmod() 函数


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 471 ::
收藏到网摘: n/a

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[模式]参数有四个数字组成:
  • The first number is always zero
    第一个数字通常是0
  • The second number specifies permissions for the owner
    第二个数字指定所有者的特许
  • The third number specifies permissions for the owner's user group
    第三个数字指定所有者用户群特许
  • The fourth number specifies permissions for everybody else
    第四个数子指定了所有人的特许

Possible values (to set multiple permissions, add up the following numbers):
可用值(为了设置多组特许,可以通过添加下面的数字)

  • 1 = execute permissions
    1 = 执行特许
  • 2 = write permissions
    2 = 可写特许
  • 4 = read permissions
    4 = 可读特许


Example
案例

<?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");
?> 

评论 (0) All

登陆 | 还没注册?