ftp_exec

(PHP 4 >= 4.0.3, PHP 5)

ftp_exec -- 請求運行一條 FTP 指令

說明

bool ftp_exec ( resource ftp_stream, string command )

傳送一個 SITE EXEC command 請求到 FTP 伺服器。若果成功(伺服器傳送響應代碼 200)則返回 TRUE,否則返回 FALSE

例子 1. ftp_exec() 例子

<?php
$command 
'ls -al';
$conn_id ftp_connect($ftp_server);
$login_result ftp_login($conn_id$ftp_user_name$ftp_user_pass);
if(
$res ftp_exec($conn_id$command)) {
    echo 
"$command executed successfully<br />\n";
    echo 
nl2br($res);
} else {
    echo 
'could not execute ' $command;
}
?>

參見 ftp_raw()