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 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 linux驱动,linux应用,多线程