PHP ftp_exec() 함수
예시
FTP 서버에서 명령 실행 요청:
<?php
// connect and login to FTP server
$ftp_server = "ftp.example.com";
$ftp_conn = ftp_connect($ftp_server) or die("Could not connect to $ftp_server");
$login = ftp_login($ftp_conn, $ftp_username, $ftp_userpass);
$command = "ls-al > somefile.txt";
// execute command
if (ftp_exec($ftp_conn,$command))
{
echo "$command executed successfully.";
}
else
{
echo "Execution of $command failed.";
}
// close connection
ftp_close($ftp_conn);
?>
정의 및 사용
ftp_exec() 함수는 FTP 서버에서 명령 실행을 요청합니다.
통사론
ftp_exec(ftp_conn, command);
매개변수 값
Parameter | Description |
---|---|
ftp_conn | Required. Specifies the FTP connection to use |
command | Required. Specifies the command to execute |
기술적 세부 사항
반환 값: | 명령이 성공적으로 실행되었으면 TRUE입니다. 그렇지 않으면 거짓 |
---|---|
PHP 버전: | 4.0.3+ |
❮ PHP FTP 참조