phpday 2027 - Call for Papers

ftp_systype

(PHP 4, PHP 5, PHP 7, PHP 8)

ftp_systype — Restituisce l'identificatore del tipo di sistema del server FTP remoto

Descrizione

function ftp_systype(FTP\Connection $ftp): string|false

Restituisce l'identificatore del tipo di sistema del server FTP remoto.

Elenco dei parametri

ftp

Un'istanza di FTP\Connection.

Valori restituiti

Restituisce il tipo del sistema remoto, oppure false in caso di errore.

Log delle modifiche

Versione Descrizione
8.1.0 Il parametro ftp ora si aspetta un'istanza di FTP\Connection; in precedenza, era attesa una resource.

Esempi

Example #1 Esempio di ftp_systype()

<?php

// connessione ftp
$ftp = ftp_connect('ftp.example.com');
ftp_login($ftp, 'user', 'password');

// ottiene il tipo di sistema
if ($type = ftp_systype($ftp)) {
    echo "Example.com utilizza $type\n";
} else {
    echo "Impossibile ottenere il tipo di sistema";
}

?>

Il precedente esempio visualizzerà qualcosa di simile a:

Example.com utilizza UNIX

User Contributed Notes 1 note

up
1
Buckwheat469 at hotmail dot com
20 years ago
ftp_systype can be a good way of checking the state of a connection, since PHP doesn't have a better system to check the state of an ftp connection (is_connected would be nice).

if (!($type = ftp_systype($conn_id))) {
    echo "FTP connection has failed! Trying again.\n";
    $conn_id = ftp_connect($ftp_server);
    $login_result = ftp_login($conn_id, $ftp_user, $ftp_pass);
}
Adding new notes is disabled. Please see the links in the Found A Problem? section.
To Top