ftp_exec

(PHP 4 >= 4.0.3, PHP 5, PHP 7, PHP 8)

ftp_execFordert die Ausführung eines Programmes auf dem FTP-Server an

Beschreibung

ftp_exec ( resource $ftp , string $command ) : bool

Sendet ein SITE EXEC-Kommando (command) an den FTP-Server.

Parameter-Liste

ftp

Die Verbindungskennung der FTP-Verbindung.

command

Das auszuführende Kommando.

Rückgabewerte

Gibt true zurück, wenn das Kommando erfolgreich war (d. h. der Server hat den Antwortcode 200 geliefert); sonst false.

Beispiele

Beispiel #1 ftp_exec()-Beispiel

<?php

// Variable initialisieren
$command 'ls -al >files.txt';

// Verbindung aufbauen
$conn_id ftp_connect($ftp_server);

// Login mit Benutzername und Passwort
$login_result ftp_login($conn_id$ftp_user_name$ftp_user_pass);

// Kommando ausführen
if (ftp_exec($conn_id$command)) {
    echo 
"$command wurde erfolgreich ausgeführt\n";
} else {
    echo 
"$command konnte nicht ausgeführt werden\n";
}

// Verbindung schließen
ftp_close($conn_id);

?>

Siehe auch

  • ftp_raw() - Sendet ein beliebiges Kommando an den FTP-Server

add a note add a note

User Contributed Notes 1 note

up
1
sam at totallydigital dot co dot nz
20 years ago
A word of caution, execution via FTP isn't very widely supported.  Check that it works on the servers that you intend to connect to before you start coding something that requires this.
To Top