简体   繁体   中英

file exists but I cannot open it using php

I can open and write in file using vim command but i cant open it using PHP

$myFile = "v.txt"; 
if(!file_exists($myFile)){
    print 'File not found';
}else if(!$fh = fopen($myFile, 'w+')){
    print 'Can\'t open file \n';}.
else{  
    print 'Success open file';
}

Do a

ls -l

on the directory that contains the file. Make sure the user that's running your web server has access read rights to the file

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM