PHP ftp_chmod() 함수
예시
파일 권한 설정:
<?php
// connect and login to FTP server
$ftp_server = "ftp.example.com";
$ftp_conn = ftp_connect($ftp_server) or die("Could not connect to $ftp_server");
$login = ftp_login($ftp_conn, $ftp_username, $ftp_userpass);
$file = "php/test.txt";
// Try to set read and write for owner and read for everybody else
if (ftp_chmod($ftp_conn, 0644, $file) !== false)
{
echo "Successfully chmoded $file to 644.";
}
else
{
echo "chmod failed.";
}
// close connection
ftp_close($ftp_conn);
?>
정의 및 사용
ftp_chmod() 함수는 FTP를 통해 지정된 파일에 대한 권한을 설정합니다.
통사론
ftp_chmod(ftp_conn, mode, file);
매개변수 값
Parameter | Description |
---|---|
ftp_conn | Required. Specifies the FTP connection to use |
mode | Required. Specifies the new permissions. This parameter consists of four numbers:
Possible values (to set multiple permissions, add up the following numbers):
|
file | Required. Specifies the file to set permissions on |
기술적 세부 사항
반환 값: | 성공 시 새 파일 권한, 실패 시 FALSE |
---|---|
PHP 버전: | 5+ |
❮ PHP FTP 참조