在php中删除目录如果是空目录我们可直接使用rmdir来删除,但是要删除非空目录我们需要先删除最子级目录的文件然后再删除空目录,其实就是递归删除目录了.
循环删除目录和文件函数,代码如下:
- function delDirAndFile( $dirName )
- {
- if ( $handle = opendir( “$dirName” ) ) {
- while ( false !== ( $item = readdir( $handle ) ) ) {
- if ( $item != “.” && $item != “..” ) {
- if ( is_dir( “$dirName/$item” ) ) {
- delDirAndFile( “$dirName/$item” );
- } else {
- if( unlink( “$dirName/$item” ) )echo “成功删除文件: $dirName/$item
- n”;
- }
- }
- }
- closedir( $handle );
- if( rmdir( $dirName ) )echo “成功删除目录: $dirName
- n”;
- }
- }
- ?>
循环目录下的所有文件,代码如下:
- function delFileUnderDir( $dirName=”../Smarty/templates/templates_c” )
- {
- if ( $handle = opendir( “$dirName” ) ) {
- while ( false !== ( $item = readdir( $handle ) ) ) {
- if ( $item != “.” && $item != “..” ) {
- if ( is_dir( “$dirName/$item” ) ) {
- delFileUnderDir( “$dirName/$item” );
- } else {
- if( unlink( “$dirName/$item” ) )echo “成功删除文件: $dirName/$item
- n”;
- }
- }
- }
- closedir( $handle );
- }
- }
- ?>
目录删除函数,代码如下:
- function my_del_dir($directory)
- {
- if (is_dir($directory) == false)
- {
- exit("The Directory Is Not Exist!");
- }
- $handle = opendir($directory);
- while (($file = readdir($handle)) !== false)
- {
- if ($file != "." && $file != "..")
- {
- is_dir("$directory/$file")?
- my_del_dir("$directory/$file"):
- unlink("$directory/$file");
- }
- }
- if (readdir($handle) == false)
- {
- closedir($handle);
- rmdir($directory);
- }
- }
- ?>
自己写的一个,$sourceDir 要删除的目录路径.
调用方法:DeleteDir(“images/abc”);删除abc目录,代码如下:
- function DeleteDir($sourceDir){
- $succeed = true;
- if(file_exists($sourceDir)){
- $objDir = opendir($sourceDir);
- while(false !== ($fileName = readdir($objDir))){
- if(($fileName != “.”) && ($fileName != “..”)){
- chmod(“$sourceDir/$fileName”,0777);
- if(!is_dir(“$sourceDir/$fileName”)){
- if(!unlink(“$sourceDir/$fileName”)){
- $succeed = false;
- break;
- }
- }
- else{
- DeleteDir(“$sourceDir/$fileName”);
- }
- }
- }
- if(!readdir($objDir)){
- closedir($objDir);
- if(!rmdir($sourceDir)){
- $succeed = false;
- }
- }
- }
- return $succeed;
- }
波比源码 – 精品源码模版分享 | www.bobi11.com
1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2. 分享目的仅供大家学习和交流,您必须在下载后24小时内删除!
3. 不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
7. 本站源码并不保证全部能正常使用,仅供有技术基础的人学习研究,请谨慎下载
8. 如遇到加密压缩包,请使用WINRAR解压,如遇到无法解压的请联系管理员!
波比源码 » php 删除非空目录自定义函数
波比源码 » php 删除非空目录自定义函数
order levaquin 500mg generic buy levaquin generic
avodart over the counter buy tamsulosin generic cheap ondansetron 8mg
acillin brand erythromycin drug erythromycin 500mg canada
buy sildenafil 100mg pill purchase nolvadex pills buy robaxin online cheap
order sildenafil 100mg pills sildenafil 100mg generic estrace order online
buy lamictal 50mg pill buy vermox online buy tretinoin generic
order tadalafil 20mg sale tadalafil 10mg sale voltaren 100mg ca
purchase indocin online cheap indomethacin 50mg tablet trimox 250mg pills
generic tadalafil 40mg cialis by mail cheap viagra online
acheter 40mg gГ©nГ©rique tadalafil en france tadalafil 40mg prix sildenafil prix
tadalafil ohne rezept viagra kaufen ohne rezept sildenafil 200mg ohne rezept
accutane ca azithromycin 250mg over the counter stromectol where to buy
clonidine 0.1mg oral generic catapres 0.1mg purchase tiotropium bromide
buspirone 5mg drug purchase buspar online order oxybutynin for sale
order hytrin 5mg generic order actos 15mg generic purchase sulfasalazine for sale
order olmesartan generic cost olmesartan 20mg diamox 250 mg pill
prograf price order tacrolimus for sale order urso 300mg online cheap
order bupropion 150mg without prescription order bupropion 150 mg generic buy quetiapine 100mg for sale
purchase molnupiravir generic naprosyn for sale online prevacid 15mg over the counter
brand salbutamol viagra 50mg pills for men sildenafil canada
cialis 10mg generic prozac 20mg cost order sildenafil 100mg generic
revia pills buy femara 2.5 mg generic abilify 20mg us
buy dapsone generic order allegra 180mg sale order perindopril 4mg sale
order fluvoxamine 100mg pill luvox 50mg pill order glucotrol generic
purchase piracetam online cheap buy viagra 100mg generic buy sildenafil pill
zithromax sale buy zithromax 250mg neurontin 800mg without prescription
rx pharmacy online cialis buy betamethasone 20gm creams buy anafranil for sale
order chloroquine 250mg for sale olumiant 4mg sale olumiant 2mg over the counter
glycomet brand tadalafil 5mg oral order cialis without prescription
metoprolol 50mg usa levitra order online levitra for sale
levitra ca buy methylprednisolone tablets buy methylprednisolone 16mg
help me write my research paper i need help with my assignment purchase viagra online
buy dapoxetine 30mg brand priligy 30mg purchase synthroid generic
orlistat canada diltiazem 180mg drug acyclovir 400mg drug
buy allopurinol 300mg pill buy rosuvastatin 10mg without prescription zetia pills
methotrexate 10mg usa buy coumadin 5mg generic buy reglan generic
cost motilium 10mg brand domperidone order flexeril 15mg sale
buy cozaar 50mg pill losartan 25mg ca topamax 200mg pills
buy imitrex 50mg online cheap buy sumatriptan 50mg online order dutasteride online cheap
order generic colchicine 0.5mg online casino usa blackjack online real money
tadalafil 20mg cheap ciprofloxacin oral oral ciprofloxacin 500mg
simvastatin ca order zocor sale propecia price
metronidazole 200mg brand clavulanate sale order bactrim pill
buy keflex 250mg pills erythromycin 250mg canada buy erythromycin 500mg pill
cialis 5mg without prescription buy viagra tablets sildenafil buy online
cheap cefuroxime 250mg order careprost pill purchase methocarbamol generic
casino online best online blackjack real money purchasing cialis on the internet
buy desyrel 100mg generic order trazodone 100mg sale aurogra 100mg for sale
academic writing services uk essay edit ivermectin 50 mg
sildenafil for men over 50 lamotrigine 50mg over the counter lamictal 200mg price
prednisone pills buy prednisone 5mg generic brand amoxicillin 1000mg
azithromycin over the counter cost gabapentin purchase gabapentin for sale
real casino games stromectol 3mg pill purchase provigil pills
order lasix pills order generic plaquenil order generic hydroxychloroquine 200mg
prednisone over the counter order mebendazole 100mg generic mebendazole 100mg generic
sildenafil 50mg tablet buy rhinocort online cheap rhinocort sale
buy tretinoin cream generic tretinoin cream oral buy avana 100mg sale
tadacip without prescription order indocin 50mg indomethacin ca
lamisil 250mg over the counter buy trimox without prescription trimox 500mg ca
naprosyn order online purchase cefdinir order lansoprazole without prescription
proventil 100 mcg generic cipro 1000mg ca ciprofloxacin cost
tiotropium bromide online buy tiotropium bromide usa purchase terazosin sale
order cialis 5mg pill Cialis pharmacy online real cialis
cialis 10mg drug Cialis free delivery spins real money online
casino machine hacks
casino online fake money
fake casino game
slot game best casino online play online roulette for fun
casino blackjack hollywood casino cheap essay help
buy ramipril 5mg online cheap order amaryl 1mg etoricoxib pills
doxycycline drug brand albuterol cleocin pill
buy research papers online no plagiarism order sulfasalazine 500 mg pills azulfidine 500mg without prescription
asacol over the counter azelastine 10ml ca order irbesartan 150mg online
generic diamox buy imuran 25mg generic generic imuran
buy digoxin 250 mg pill lanoxin 250 mg pills molnupiravir ca
coreg 25mg for sale order amitriptyline generic buy generic amitriptyline 10mg
order priligy 30mg online cheap buy domperidone motilium online order
fosamax 70mg without prescription motrin over the counter motrin 600mg canada
buy generic nortriptyline paracetamol for sale buy paxil 10mg
doxycycline 100mg brand order doxycycline 100mg online methylprednisolone 16 mg pills
order tadalafil 10mg pill trimox 250mg brand buy generic trimox 250mg
buy ropinirole 1mg generic order labetalol 100 mg generic buy generic labetalol
order nexium 40mg brand nexium buy lasix 100mg generic
order tadalafil 5mg sale Cialis for women viagra 200mg
purchase metformin generic calan 240mg cost nolvadex 10mg brand
cheap cialis pill Cialis overnight delivery top rated ed pills
oral provigil generic stromectol 12mg order promethazine generic
buy isotretinoin 10mg deltasone 20mg usa buy acillin online cheap
order prednisone 10mg online purchase accutane generic buy amoxicillin 250mg online cheap
buy ivermectin 6 mg for humans ed pills cheap order deltasone 20mg online
otc ed pills fildena over the counter buy finasteride pill
accutane 10mg brand buy azithromycin online cheap azithromycin 500mg brand
purchase zofran pills cost amoxil buy sulfamethoxazole pill
albuterol order augmentin over the counter augmentin 1000mg uk
order prednisolone 40mg online gabapentin 100mg tablet buy lasix generic
buy generic modafinil 200mg lisinopril cost metoprolol 100mg pills
doxycycline brand vardenafil cheap zovirax online buy
avodart over the counter cephalexin 125mg us buy xenical 60mg
cefdinir tablet order cefdinir 300 mg buy protonix 40mg generic
uroxatral for sale online order diltiazem without prescription diltiazem online buy
order avlosulfon without prescription buy tenormin generic where can i buy tenormin
real viagra pills viagra pills 50mg cialis 20mg pill
buy ezetimibe 10mg pill order zetia without prescription cost methotrexate 2.5mg
займ на карту срочно
срочно займ на карту история плохая
займ на карту срочно без отказа
buy levofloxacin 500mg without prescription purchase levaquin online cheap zyban 150mg over the counter
oral cetirizine order cetirizine sale sertraline over the counter
cenforce cost metformin without prescription metformin oral
ivermectin 6mg tablets buy accutane online purchase absorica online
provigil for sale online phenergan price buy deltasone 40mg generic
buy gabapentin tablets buy lasix online buy monodox
tenormin 100mg pill buy cheap generic femara order letrozole 2.5 mg for sale
cost albenza 400 mg aripiprazole 30mg pill buy medroxyprogesterone 5mg online cheap
buy glucophage 1000mg online buy atorvastatin 80mg online amlodipine price
buy methotrexate 2.5mg sale purchase metoclopramide for sale where can i buy reglan
xenical 60mg canada order xenical generic buy generic zyloprim over the counter
buy cozaar pills topamax order online buy topiramate 200mg without prescription
buy rosuvastatin online cheap zetia where to buy buy generic domperidone
buy sumatriptan cost avodart oral avodart 0.5mg
where to buy clopidogrel without a prescription clopidogrel 150mg price generic ketoconazole 200mg
purchase cymbalta pills order cymbalta 20mg online purchase nootropil pills
buy betamethasone pills for sale where can i buy sporanox order sporanox 100mg generic
buy nateglinide without prescription starlix 120mg oral buy candesartan 16mg sale
simvastatin 20mg pills zocor 20mg cost viagra 100mg oral
tegretol 400mg generic ciplox 500mg oral lincomycin 500 mg generic
metronidazole 200mg cost buy metronidazole 200mg generic how to buy cephalexin
buy tamoxifen 10mg pill buy generic nolvadex online cefuroxime 500mg ca
cheap clonidine buy antivert without prescription spiriva 9mcg pills
suhagra 50mg uk buy sildenafil 50mg pills buy sildalis
cheap azipro gabapentin 800mg pills neurontin order online
buy furosemide for sale purchase monodox online cheap order albuterol for sale
asacol 400mg brand avapro 300mg price avapro 150mg uk
temovate generic buy amiodarone 200mg online cheap amiodarone buy online
Sex toys https://self-lover.store/ have become an integral part of modern intimate life for many people. Their variety strikes the imagination. In intimate goods stores you can find many different types and models that help diversify your sex life and give pleasure.
buy clobetasol cream order buspirone 5mg pills amiodarone 200mg drug
order acetazolamide 250 mg sale acetazolamide pill order imuran 25mg pills
order coreg without prescription buy cenforce generic buy aralen 250mg generic
digoxin 250mg pill buy lanoxin 250mg without prescription molnunat 200 mg cheap
order generic naprosyn order naprosyn 250mg for sale buy prevacid generic
albuterol 100mcg for sale order pantoprazole 20mg without prescription phenazopyridine for sale online
buy singulair generic dapsone pills cheap avlosulfon 100mg
buy olumiant 2mg for sale buy glucophage paypal buy atorvastatin no prescription
amlodipine cheap cheap omeprazole 20mg buy prilosec 10mg generic
diltiazem 180mg tablet buy zovirax for sale cheap zyloprim 100mg
rosuvastatin brand order crestor sale order generic motilium 10mg
sumycin 250mg canada cyclobenzaprine generic baclofen 25mg brand
toradol 10mg ca inderal 10mg cheap cost propranolol
clopidogrel 75mg without prescription purchase methotrexate pills warfarin 2mg ca
buy generic erythromycin buy nolvadex generic nolvadex price
topamax online topiramate 200mg cost buy generic levaquin online
avodart pills mobic 7.5mg usa mobic cheap
order aurogra 100mg online sildenafil 50mg price buy estrace pill
lamotrigine price order minipress 2mg online prazosin 1mg uk
order generic spironolactone 25mg spironolactone 25mg cost valtrex 500mg brand
propecia 5mg canada sildenafil online order sildenafil 100mg without prescription
female cialis cialis generic buy generic sildenafil 50mg
cheap tadalafil online order diflucan 200mg cheap erectile dysfunction pills online
lamisil 250mg sale buy lamisil cheap trimox oral
order azathioprine for sale digoxin 250 mg brand oral micardis
antivert 25mg drug minomycin pills minocin 50mg generic
oral molnunat 200mg order naprosyn generic omnicef sale
can you buy ed pills online buy generic sildenafil viagra 100mg usa
buy lansoprazole online buy pantoprazole 20mg for sale protonix tablet
red ed pill cialis 5mg for sale cialis buy online
mens ed pills order cialis 5mg for sale cialis 10mg ca
fexofenadine usa allegra 120mg pill glimepiride 1mg drug
etoricoxib price asacol uk order generic azelastine 10ml
terazosin 1mg over the counter hytrin 1mg oral tadalafil 20mg oral
avapro 150mg generic order buspar 5mg without prescription buspar price
buy albendazole medication aripiprazole 20mg cheap order provera for sale
generic ditropan 5mg buy amitriptyline 10mg without prescription alendronate price
purchase biltricide generic periactin online buy order periactin without prescription
fluvoxamine for sale luvox price cymbalta 20mg cost
purchase glipizide pills piracetam 800 mg pill order betnovate 20gm creams
acetaminophen 500 mg cheap buy cheap generic paracetamol order famotidine 20mg online
tinidazole where to buy zyprexa 10mg us buy nebivolol no prescription
decadron 0,5 mg uk buy cheap generic linezolid purchase starlix pills
generic trileptal order trileptal for sale order actigall online cheap
captopril 25mg us buy candesartan medication carbamazepine usa
bupropion 150mg oral buy cheap generic strattera buy strattera 10mg online cheap
order ciprofloxacin pills order duricef generic buy generic cefadroxil online
buy generic seroquel 100mg zoloft 100mg uk escitalopram 10mg cost
epivir cheap buy quinapril pills for sale quinapril 10 mg without prescription
sarafem for sale online femara 2.5mg without prescription order femara sale
frumil 5mg sale buy generic clindamycin for sale acivir sale
bisoprolol 5mg sale buy ethambutol 1000mg for sale order generic oxytetracycline
valaciclovir where to buy cotrimoxazole drug floxin 400mg generic