ฟังก์ชั่นลบโฟลเดอร์ (Remove Folder)
บันทึกโดย วันที่ 5 December 2007 | 1,935 views
Function
<?php
function removeFolder($dir){
if(!is_dir($dir))
return false;
for($s = DIRECTORY_SEPARATOR, $stack = array($dir), $emptyDirs = array($dir); $dir = array_pop($stack);){
if(!($handle = @dir($dir)))
continue;
while(false !== $item = $handle->read())
$item != '.' && $item != '..' && (is_dir($path = $handle->path . $s . $item) ?
array_push($stack, $path) && array_push($emptyDirs, $path) : unlink($path));
$handle->close();
}
for($i = count($emptyDirs); $i--; rmdir($emptyDirs[$i]));
}
?>
Eaxmple
removeFolder("ชื่อโฟลเดอร์");


โห สุดยอด โดนมากๆ เลยครับ
May 30th, 2008 at 6:30 pm
ขอบคุณมากๆค่ะ
เอาไปใช้งานได้เรย
สุดยอดจิงๆ
เหอๆ
^^
February 5th, 2009 at 1:11 am
A friend is never known till a man has need
March 12th, 2009 at 10:53 am