Home > Backend Development > PHP Problem > What to do if php readfile error occurs

What to do if php readfile error occurs

藏色散人
Release: 2023-03-09 14:52:02
Original
2900 people have browsed it

php readfile error is because an extra newline character is output in the code. The solution is: first open the corresponding PHP file; then delete the extra output newline character; and finally read the file through readfile again.

What to do if php readfile error occurs

The operating environment of this article: Windows7 system, PHP7.1 version, DELL G3 computer

Specific questions:

php readfile read file error?

What to do if php readfile error occurs

Opening it like this means that the picture is damaged. Please solve it. How to solve it? Why does this work?

Solution:

Output an extra newline character

<?php
header(&#39;Content-Type: image/jpeg&#39;);
readfile(&#39;626123287.jpg&#39;);
exit(0);
?>
Copy after login

Recommended study:《 PHP video tutorial

The above is the detailed content of What to do if php readfile error occurs. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template