FTP_exec() फ़ंक्शन का उपयोग FTP सर्वर पर कमांड निष्पादित करने के लिए किया जाता है।
सिंटैक्स
ftp_exec(con, command)
पैरामीटर
-
चोर - एफ़टीपी कनेक्शन
-
आदेश - निष्पादित करने का आदेश।
वापसी
यदि आदेश सफलतापूर्वक निष्पादित किया गया था, तो ftp_exec() फ़ंक्शन TRUE लौटाता है, अन्यथा FALSE।
उदाहरण
निम्नलिखित एक उदाहरण है जो FTP सर्वर पर एक कमांड निष्पादित करता है -
<?php
$ftp_server="192.168.0.4";
$ftp_user="amit";
$ftp_pass="tywg61gh";
$con = ftp_connect($ftp_server) or die("Could not connect to $ftp_server");
// list all the files of the remote directory
$command = 'ls';
// execute command
if (ftp_exec($con,$command)) {
echo "Executed successfully!";
} else {
echo "Execution failed!";
}
ftp_close($con);
?>