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

PHP
PHP 安全邮件
MySQL 介绍
连接 MySQL
创建 MySQL
MySQL 插入记录
MySQL 选择记录
MySQL Where
MySQL Order By
MySQL 记录更新
MySQL 删除记录
PHP ODBC
XML Expat Parser
XML SimpleXML
PHP 数组参考
PHP Calendar
PHP Date
PHP Directory
PHP Filesystem
PHP FTP
PHP HTTP

PHP 中的 chmod() 函数


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 468 ::
收藏到网摘: 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

登陆 | 还没注册?