PHP ftp_site() Functie
Voorbeeld
Stuur een FTP SITE-opdracht:
<?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);
// try to send SITE command
if (ftp_site($ftp_conn, "chmod 777 serverfile.txt"))
{
echo "Command executed successfully";
}
else
{
echo "Command failed";
}
// close connection
ftp_close($ftp_conn);
?>
Definitie en gebruik
De functie ftp_site() stuurt een SITE-opdracht naar de FTP-server.
Opmerking: SITE-opdrachten verschillen van server tot server. Ze zijn handig voor het afhandelen van OS-specifieke functies zoals bestandsrechten en groepslidmaatschap.
Tip: Om te zien welke SITE-commando's beschikbaar zijn, stuurt u de REMOTEHELP-commando met behulp van de ftp_raw()- functie.
Syntaxis
ftp_site(ftp_conn, command);
Parameterwaarden
Parameter | Description |
---|---|
ftp_conn | Required. Specifies the FTP connection to use |
command | Required. Specifies the SITE command (this parameter is not escaped) |
Technische details
Winstwaarde: | WAAR bij succes, ONWAAR bij mislukking |
---|---|
PHP-versie: | 4+ |
❮ PHP FTP-referentie