Funzione PHP ftp_chmod()
Esempio
Imposta i permessi dei file:
<?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);
?>
Definizione e utilizzo
La funzione ftp_chmod() imposta le autorizzazioni sul file specificato tramite FTP.
Sintassi
ftp_chmod(ftp_conn, mode, file);
Valori dei parametri
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 |
Dettagli tecnici
Valore di ritorno: | Le nuove autorizzazioni per i file in caso di successo, FALSE in caso di errore |
---|---|
Versione PHP: | 5+ |
❮ Riferimento FTP PHP