public function deleteAllEmailRelatedFolders($clientID) {
$path = getcwd();
//Delete Email Inbox Attachments
$dir = $path . "\cdn\data\inbox/$clientID";
//Delete Email Sent Attachments
$dir2 = $path . "\cdn\data\sent/$clientID";
var_dump($dir);
var_dump($dir2);
$this->rrmdir($dir);
$this->rrmdir($dir2);
}
protected function rrmdir($dir) {
if (is_dir($dir)) {
$objects = scandir($dir);
foreach ($objects as $object) {
if ($object != "." && $object != "..") {
if (filetype($dir . "/" . $object) == "dir")
$this->rrmdir($dir . "/" . $object);
else
unlink($dir . "/" . $object);
}
}
reset($objects);
rmdir($dir);
}
}
当我尝试rmdir在我的linux上运行时。它无法正常工作。当我在我的localhost中运行WAMP服务器时。它工作正常。请帮我解决这个问题
答案 0 :(得分:2)
正如shatheesh在评论中指出的那样,你的路径格式不正确。
将路径更改为:
//Delete Email Inbox Attachments
$dir = $path . "/cdn/data/inbox/$clientID";
//Delete Email Sent Attachments
$dir2 = $path . "/cdn/data/sent/$clientID";
有关Linux目录路径及其功能的更多信息,请访问http://www.tecmint.com/linux-directory-structure-and-important-files-paths-explained/