Local test was successful, but failed to open the file after uploading the server (fopen and file_exists)

1, it can be run locally;
2. After uploading the server, both fopen and file_exists failed. I printed the file address, no problem, specially opened the alternate address, or failed

.
function charaget($data){
  if(!empty($data) ){    
    $fileType = mb_detect_encoding($data , array("UTF-8","GBK","LATIN1","BIG5")) ;   
    if( $fileType != "GB2312"){   
      $data = mb_convert_encoding($data ,"GB2312" , $fileType);   
    }   
  }   
  return $data;    
}

after use, the code can print the correct path, but can not read the file, and finally converted to UTF-8, the server will be normal, I do not know what other methods.

Php
Mar.17,2021

1, file permissions
2, folder permissions

is set to 777, which should be fine


it is useless to simply set a single file to 777.If the folder also needs to set permissions


in Chinese, it's best to convert the file name encoding to gbk
iconv function to learn about


I think there is another possibility, that is, the path of code execution on your server is different from that of local execution, so if the relative path of your file is written in that way, May not be correct


file_exists several errors, as follows

1.,. 'shujuku/-2018-06-06.dat',.index.php.
2..php. 755.777.
3.file_exists..clearstatcache().
4.file_exists.linuxutf-8,windowsgbk.utf-8.conv('UTF-8','gb2312','./.zip');.

Please check these four reasons in detail. It can solve 99% of the problems.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b399d9-2c1d7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b399d9-2c1d7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?