09/10/2018, 22:42
hoi cach xoa tap tin va thuc muc
cac ban cho hoi lam sao xoa duoc file va thu muc bang php.?
neu cac ban co code thi gui cho minh .cam on nhieu
net_chat_com@yahoo.com
neu cac ban co code thi gui cho minh .cam on nhieu
net_chat_com@yahoo.com
Bài liên quan
@achilles82: xài rmdir()
------------------------------
rmdir
(PHP 3, PHP 4 , PHP 5)
rmdir -- Removes directory
Description
bool rmdir ( string dirname [, resource context] )
Attempts to remove the directory named by dirname. The directory must be empty, and the relevant permissions must permit this. Returns TRUE on success or FALSE on failure.
Note: As of PHP 5.0.0 rmdir() can also be used with some URL wrappers. Refer to Appendix L for a listing of which wrappers support rmdir().
Note: Context support was added with PHP 5.0.0. For a description of contexts, refer to Reference CXX, Stream Functions.
Note: When safe mode is enabled, PHP checks whether the directory in which you are about to operate has the same UID (owner) as the script that is being executed.
Chú ý mấy chỗ style: bold.
nhưng phải có quyền trên server
cac cao thu php oi, to gap kho khan khi xoa mot website tren hosting, dung ftp xoa thi qua cham khi xoa ca website 20Mb. Vi minh can xoa de up website khac len.thao tac nay minh thuc hien rat nhieu lan.nen to muon tim cach lap trinh php de xoa cho nhanh hon. Theo cac ban xoa bang php nhanh hon khong?. vi To thay unzip tren server cuc nhanh luon. Ca website 20Mb unzip trong khoang 5s a. Nho cac cao thu chi cho minh chi tiet hon mot chut nha. cam on nhieu
function deldir($dir) {
$dir.="/";
if ($handle = @opendir($dir)) {
while ($file = readdir($handle))
if (($file != ".") and ($file !=".."))
if (is_dir($dir.$file)) deldir($dir.$file);
else unlink($dir.$file);
closedir($handle);
rmdir($dir); }
}
deldir('E:/Temp');
?>