PHP ftp_exec () 함수
정의 및 사용
ftp_exec () 함수는 FTP 서버에 프로그램 또는 명령을 실행하도록 요청한다.
성공하면, 함수는 TRUE를 반환합니다. 실패하면 FALSE를 반환합니다.
문법
ftp_exec(ftp_connection,command)
参数 | 描述 |
---|---|
ftp_connection | 必需。规定要使用的 FTP 连接。 |
command | 必需。规定发送到 FTP 服务器的命令请求。 |
팁과주의 사항
참고 : ftp_raw () 함수는 다른과 함께, ftp_exec ()는 FTP 서버에 로그인 한 후에 만 명령을 전송합니다.
예
<?php
$command = "ls-al > test.txt";
$conn = ftp_connect("ftp.testftp.com") or die("Could not connect");
ftp_login($conn,"admin","ert456");
if (ftp_exec($conn,$command))
{
echo "Command executed successfully";
}
else
{
echo "Execution of command failed";
}
ftp_close($conn);
?>
$command = "ls-al > test.txt";
$conn = ftp_connect("ftp.testftp.com") or die("Could not connect");
ftp_login($conn,"admin","ert456");
if (ftp_exec($conn,$command))
{
echo "Command executed successfully";
}
else
{
echo "Execution of command failed";
}
ftp_close($conn);
?>
PHP FTP 참조 완료