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 鼠标右键,撤销删除 复制 移动,要怎样删除
  • ¥15 使用MATLAB进行余弦相似度计算加速
  • ¥15 服务器安装php5.6版本
  • ¥15 我想用51单片机和数码管做一个从0开始的计数表 我写了一串代码 但是放到单片机里面数码管只闪烁一下然后熄灭
  • ¥20 系统工程中,状态空间模型中状态方程的应用。请猛男来完整讲一下下面所有问题
  • ¥15 我想在WPF的Model Code中获取ViewModel Code中的一个参数
  • ¥15 arcgis处理土地利用道路 建筑 林地分类
  • ¥20 使用visual studio 工具用C++语音,调用openslsx库读取excel文件的sheet问题
  • ¥100 寻会做云闪付tn转h5支付链接的技术
  • ¥15 DockerSwarm跨节点无法访问问题