PHP ftp_chmod() 函数
完整的 PHP FTP 参考手册
定义和用法
ftp_chmod() 函数设置 FTP 服务器上指定文件的权限。
如果成功,该函数返回新的权限。如果失败,则返回 FALSE 和一个警告。
语法
ftp_chmod(ftp_connection,mode,file)
参数 | 描述 |
---|---|
ftp_connection | 必需。规定要使用的 FTP 连接。 |
mode | 必需。规定新的权限。 mode 参数由 4 个数字组成:
可能的值(如需设置多个权限,请对下面的数字进行总计):
|
file | 必需。规定要修改权限的文件的名称。 |
实例
<?php
$conn = ftp_connect("ftp.testftp.com") or die("Could not connect");
ftp_login($conn,"user","pass");
// Read and write for owner, nothing for everybody else
ftp_chmod($conn,"0600","test.txt");
// Read and write for owner, read for everybody else
ftp_chmod($conn,"0644","test.txt");
// Everything for owner, read and execute for everybody else
ftp_chmod($conn,"0755","test.txt");
// Everything for owner, read for owner's group
ftp_chmod($conn,"0740","test.txt");
ftp_close($conn);
?>
$conn = ftp_connect("ftp.testftp.com") or die("Could not connect");
ftp_login($conn,"user","pass");
// Read and write for owner, nothing for everybody else
ftp_chmod($conn,"0600","test.txt");
// Read and write for owner, read for everybody else
ftp_chmod($conn,"0644","test.txt");
// Everything for owner, read and execute for everybody else
ftp_chmod($conn,"0755","test.txt");
// Everything for owner, read for owner's group
ftp_chmod($conn,"0740","test.txt");
ftp_close($conn);
?>
完整的 PHP FTP 参考手册
点我分享笔记