donglei7152 2019-01-18 21:44
浏览 69
已采纳

我有问题让ftp_delete在PHP中工作[重复]

This question already has an answer here:

Having trouble deleting a directory/folder via ftp php script..

I am getting a weird warning in my php log, and the ftp_delete function is not working. Please see below

PHP LOG says:

PHP Warning: ftp_delete(): End in C:\Hosting\HYPV\website.com\wwwroot\Services\TestDelete.php on line 29

<?php


require('../FTPconfig.php');

$conn_id = ftp_connect($ftp_server);

$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

ftp_pasv($conn_id,true);

$contents = ftp_nlist($conn_id, "/FTP/website.com/wwwroot/Clients/clientName/Reports/");


if ($contents == true) {

foreach ($contents as $file) {

    $local_file = $file;
    $server_file = '/FTP/website.com/wwwroot/Clients/clientName/Reports/'.$file;

    ftp_delete($conn_id, $server_file); //<------------------- PHP LOG says: ftp_delete(): End in C:\Hosting\HYPV\website.com\wwwroot\Services\TestDelete.php on line 29

}

} else {

    echo "No files available.";

}


ftp_close($conn_id);


?>
</div>
  • 写回答

1条回答 默认 最新

  • dongtan4046 2019-01-18 22:42
    关注

    I figured it out thanks to Barmar. I needed to empty the contents of the directory first and then I needed to use the ftp_rmdir function to delete the directory. ftp_delete wasn't working...

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误
  • ¥15 (关键词-阻抗匹配,HFSS,RFID标签天线)
  • ¥15 机器人轨迹规划相关问题
  • ¥15 word样式右侧翻页键消失