php教程

ftp_exec

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

ftp_exec请求运行一条 FTP 命令

说明

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

发送一个 SITE EXEC command 请求到 FTP 服务器。如果成功(服务器发送响应代码 200)则返回 TRUE,否则返回 FALSE

Example #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()

User Contributed Notes

sam at totallydigital dot co dot nz 16-Dec-2003 01:34
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.

CopyRight © 2008-2022 verySource.Com All Rights reserved. 京ICP备17048824号-1 京公网安备:11010502034788