|
|
 |
chmod (PHP 3, PHP 4 , PHP 5) chmod -- 改变文件模式 说明bool chmod ( string filename, int mode)
尝试将 filename 所指定文件的模式改成
mode 所给定的。
注意 mode 不会被自动当成八进制数值,而且也不能用字符串(例如 "g+w")。要确保正确操作,需要给
mode 前面加上 0:
mode 参数包含三个八进制数按顺序分别指定了所有者、所有者所在的组以及所有人的访问限制。每一部分都可以通过加入所需的权限来计算出所要的权限。数字 1
表示使文件可执行,数字 2 表示使文件可写,数字 4
表示使文件可读。加入这些数字来制定所需要的权限。有关 UNIX 系统的文件权限可以阅读手册“man 1
chmod”和“man 2 chmod”。
如果成功则返回 TRUE,失败则返回 FALSE。
注:
当前用户指的是执行 PHP 的用户。很可能和通常的 shell 或者 FTP 用户不是同一个。
注: 本函数不能作用于远程文件,被检查的文件必须通过服务器的文件系统访问。
参见 chown() 和 chgrp()。
gnettles2 at home dot com
25-Aug-2001 02:20
Usually when you're trying to write to af file, you'll need to chmod the
file to something like 666 or 755. You can use a command to chmod the file
for you, which is especially useful when you're making a script where
you're setting it up so that your users don't have to peform a bunch of
actions to setup the script. When i wrote my news program script, I only
had two files. install.php and config.php. All you had to do was chmod
install.php to 666 and open it up in a web browser and answer a few
questions. The script itself setup the rest of the files and chmodded them
for you.
| |