在php中文件操作函数有很多很多,下面我来给各们同学介绍在php中文件操作常用函数使用方法与介绍.
1、获取文件名:basename();
2、获取文件所在的目录:dirname();
3、pathinfo()获取文件信息,返回结果为一个array,包括路径、文件全名、文件名和扩展名.
实例代码如下:
- $file = '/com/netingcn/error.log';
- print_r(pathinfo($file));
结果为:
- Array(
- [dirname] => /com/netingcn
- [basename] => error.log
- [extension] => log
- [filename] => error
- )
4、判断文件是否存在:is_file();
5、判断目录是否存在:is_dir();
6、判断文件或目录是否存在:file_exists();
7、读取文件所有内容:file()或file_get_contents(),其中file()返回的是一个一行为元素的array,file_get_contents()把文件全部内容作为一个String返回;
8、写文件fwrite,如:
实例代码如下:
- $handler = fopen($file, 'w'); // w 会冲掉以前的内容、a 是追加
- fwrite($handler, 'content');
- fclose($handler); //记得关闭打开的文件句柄9、文件读取操作有很多,下面简单介绍几个:
- $handler = fopen($file, 'r');
- while(!feof($handler)) {
- $datas[] = fgets($handler); //读取一行内容
- }
- while(!feof($handler)) {
- $datas[] = fgetss($handler); //读取一行内容并过来html标记
- }
- while(!feof($handler)) {
- $datas[] = fgetcsv($handler); //读取一行内容并解析csv字段
- }
- $content = fread($handler, $strLength); //读取指定长读的字符
- fclose($handler);
波比源码 – 精品源码模版分享 | www.bobi11.com
1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2. 分享目的仅供大家学习和交流,您必须在下载后24小时内删除!
3. 不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
7. 本站源码并不保证全部能正常使用,仅供有技术基础的人学习研究,请谨慎下载
8. 如遇到加密压缩包,请使用WINRAR解压,如遇到无法解压的请联系管理员!
波比源码 » php文件操作之常用文件操作笔记
波比源码 » php文件操作之常用文件操作笔记
levaquin 500mg brand buy levofloxacin 500mg online
avodart cost buy flomax 0.2mg pills buy zofran 4mg online cheap
aldactone oral aldactone pills buy generic fluconazole 100mg
buy acillin online cephalexin for sale purchase erythromycin
fildena 100mg uk nolvadex medication buy methocarbamol 500mg generic
suhagra 100mg tablet order sildenafil 100mg estradiol 1mg us
lamictal price order mebendazole pill tretinoin price
tadalis online order buy tadacip pill buy diclofenac
order indomethacin online cheap lamisil pills order trimox for sale
buy cialis 40mg pill Order viagra buy sildenafil 50mg sale
cialis 10mg sans ordonnance cialis 5mg comprimГ© sildenafil 100mg sans ordonnance en france
buy prednisone 20mg online cheap cialis pharmacy online sildenafil 100mg oral
tadalafil 20mg kaufen für männer tadalafil kaufen sildenafil 50mg für männer
buy isotretinoin 10mg online buy zithromax 250mg ivermectin 2ml
modafinil price buy diamox 250mg online cheap purchase diamox generic
buy fosamax 70mg sale purchase pepcid without prescription buy famotidine 40mg pill
purchase prograf requip 1mg over the counter buy ursodiol 150mg pill
imdur 20mg price buy digoxin for sale buy micardis 20mg pill
oral zyban 150mg cheap atomoxetine order seroquel pills
buy zoloft 50mg online cheap Viagra overnight shipping sildenafil 100mg ca
buy imuran 100mcg for sale imuran order online viagra 25mg
oral dapsone 100 mg perindopril drug aceon 8mg drug
order provera generic buy biltricide 600mg for sale order generic cyproheptadine 4 mg
provigil online order cheap stromectol 3mg ivermectin 6 mg pills for humans
buy fluvoxamine 50mg order nizoral buy glucotrol 10mg generic
accutane 20mg pills amoxicillin 500mg ca deltasone usa
order lasix generic order lasix 40mg online plaquenil 200mg us
tadalafil 20mg canada buy cialis 40mg buy anafranil 25mg online
order chloroquine generic buy chloroquine sale order generic baricitinib 2mg
purchase metformin generic glycomet over the counter tadalafil 5mg usa
buy zyprexa 10mg without prescription diovan 80mg for sale order valsartan 80mg online
order norvasc 10mg pills cialis coupon cialis online buy
clozaril for sale cheap dexamethasone buy decadron generic
order sildenafil 100mg sale viagra 100mg cheap lisinopril uk
omeprazole drug cheap paper writing casino online slots
oral lopressor 100mg metoprolol 100mg for sale vardenafil usa
order tadalafil pills buy tadalafil 10mg generic viagra for sale
aristocort 4mg us desloratadine 5mg oral purchase desloratadine sale
buy orlistat 120mg without prescription buy xenical 120mg sale zovirax 800mg pill
order tadalafil 40mg for sale generic inderal 10mg brand clopidogrel 150mg
buy zyloprim 300mg pills buy zetia 10mg pill buy zetia pills
order methotrexate 2.5mg pills coumadin 2mg without prescription buy reglan 10mg pill
motilium drug motilium 10mg pill cyclobenzaprine pills
purchase cozaar online cheap order topiramate without prescription topamax 100mg price
imitrex us order avodart 0.5mg pills dutasteride brand
zantac 150mg usa order ranitidine 300mg order celecoxib 100mg sale
texas poker online casino online real money poker online for real money
tamsulosin 0.4mg uk buy spironolactone 100mg sale order aldactone for sale
buy simvastatin 10mg pills simvastatin 20mg oral buy propecia for sale
buy cefuroxime online cheap cefuroxime 250mg us purchase methocarbamol pills
bonus poker online order tadalafil 40mg pills tadalafil 5mg pill
mba essay service stromectol online buy ivermectin 12 mg for sale
sildenafil 100mg usa order generic estradiol 1mg purchase lamictal generic
order sildenafil for sale cialis australia buy generic cialis 40mg
free slots casino games gambling games order modafinil
lasix 100mg for sale buy doxycycline 100mg without prescription buy hydroxychloroquine 400mg generic
buy deltasone 5mg online minipress 2mg without prescription order mebendazole 100mg pill
tretinoin over the counter buy retin gel online cheap buy avanafil 100mg pills
tadalafil without prescription diclofenac 50mg us buy indocin without prescription
order terbinafine online cheap generic lamisil 250mg amoxicillin canada
order tiotropium bromide 9 mcg generic terazosin 5mg cheap hytrin us
casino games online real money casino arizona blackjack vegas free online games
ramipril us order amaryl 1mg pill order etoricoxib 120mg
order coreg 25mg for sale order carvedilol online buy amitriptyline
order amoxil 250mg generic stromectol 12mg over the counter ivermectin generic name
buy generic alendronate 70mg alendronate 35mg over the counter ibuprofen order
nortriptyline 25 mg us order nortriptyline 25mg pills cost paxil
indomethacin pills indomethacin 75mg cheap cenforce 100mg without prescription
oral doxycycline buy medrol 16 mg online medrol 16 mg otc
order tadalafil online cheap tadacip 20mg cheap order trimox 500mg for sale
purchase glucophage generic buy metformin 1000mg sale buy tamoxifen online
provigil cheap provigil 200mg drug buy promethazine without prescription
accutane over the counter acillin usa ampicillin cheap
best ed pills at gnc lyrica 75mg sale purchase propecia generic
cost of ivermectin medicine generic stromectol 12mg deltasone 10mg sale
prednisolone 40mg us order prednisolone generic furosemide 40mg for sale
generic doxycycline monodox uk buy zovirax
ditropan 5mg cost oral oxcarbazepine 300mg trileptal 600mg ca
order cefdinir 300mg online cheap oral prevacid 30mg protonix 40mg generic
buy zocor 20mg sale phenergan cheap sildenafil overnight shipping usa
order alfuzosin 10 mg generic trazodone 100mg us buy diltiazem online cheap
warfarin 2mg tablet buy generic warfarin 5mg order zyloprim