donglei7152 2019-01-18 13: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 14: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 torch框架下的强化学习DQN训练奖励值浮动过低,希望指导如何调整
  • ¥35 西门子博图v16安装密钥提示CryptAcquireContext MS_DEF_PROV Error of containger opening
  • ¥15 mes系统扫码追溯功能
  • ¥40 selenium访问信用中国
  • ¥20 在搭建fabric网络过程中遇到“无法使用新的生命周期”的报错
  • ¥15 Python中关于代码运行报错的问题
  • ¥500 python 的API,有酬谢
  • ¥15 软件冲突问题,软件残留问题
  • ¥30 有没有人会写hLDA,有偿求写,我有一个文档,想通过hLDA得出这个文档的层次主题,有偿有偿!
  • ¥50 有没有人会写hLDA,有偿求写,我有一个文档,想通过hLDA得出这个文档的层次主题,有偿有偿!