PHP ftp_exec() 函數(shù)
PHP ftp_exec() 函數(shù)

定義和用法
ftp_exec() 函數(shù)請求在 FTP 服務(wù)器上執(zhí)行一個程序或命令。
如果成功,該函數(shù)返回 TRUE。如果失敗,則返回 FALSE。
語法
ftp_exec(ftp_connection,command)
參數(shù) | 描述 |
---|---|
ftp_connection | 必需。規(guī)定要使用的 FTP 連接。 |
command | 必需。規(guī)定發(fā)送到 FTP 服務(wù)器的命令請求。 |
提示和注釋
注釋:與 ftp_raw() 函數(shù) 不同,ftp_exec() 只有在登錄到 FTP 服務(wù)器后才能發(fā)送命令。
實(shí)例
<?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);
?>

相關(guān)文章
- PHP 變量
- PHP 常量
- PHP 數(shù)組排序
- PHP 函數(shù)
- PHP 命名空間 namespace
- PHP $_POST 變量
- PHP 包含文件 include 和 require 語句
- PHP 文件上傳
- PHP Secure E-mails
- PHP array_change_key_case() 函數(shù)
- PHP array_diff_assoc() 函數(shù)
- PHP array_fill() 函數(shù)
- PHP array_intersect_key() 函數(shù)
- PHP array_key_first() 函數(shù)
- PHP array_push() 函數(shù)
- PHP array_rand() 函數(shù)
- PHP array_udiff() 函數(shù)
- PHP uasort() 函數(shù)
- PHP usort() 函數(shù)
- PHP 5 Filesystem 函數(shù)