The solution to the problem that the file cannot be found when downloading php: first open the corresponding code file; then modify the content to "ini_set('memory_limit','350M');"; finally add the "ob_end_clean()" function and Just save the changes.
Recommended: "PHP Video Tutorial"
Solution to the problem that the PHP download file is too large and the file cannot be found The method
set_time_limit(0); ini_set('memory_limit','350M'); header("Cache-Control: public"); header("Content-Description: File Transfer"); header('Content-disposition: attachment; filename=' . basename($file_name . $extension)); //文件名 header("Content-Transfer-Encoding: binary"); //告诉浏览器,这是二进制文件 header('Content-Length: ' . filesize($filename)); //告诉浏览器,文件大小 ob_end_clean(); readfile($file);
is mainly the setting of memory_limit() and the use of ob_end_clean() function
The above is the detailed content of What should I do if the file cannot be found when downloading php?. For more information, please follow other related articles on the PHP Chinese website!