Home  >  Article  >  Backend Development  >  What should I do if the file cannot be found when downloading php?

What should I do if the file cannot be found when downloading php?

藏色散人
藏色散人Original
2020-11-05 09:10:392428browse

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.

What should I do if the file cannot be found when downloading php?

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn