Home > Backend Development > PHP Tutorial > Regarding the abnormal line break error that occurs when using file to read the entire file, I have not tried it, but it is best to..._PHP tutorial when reading files

Regarding the abnormal line break error that occurs when using file to read the entire file, I have not tried it, but it is best to..._PHP tutorial when reading files

WBOY
Release: 2016-07-13 17:28:25
Original
841 people have browsed it

About the abnormal line break error that occurs when using file() to read the entire file! I am currently using PHP 4.03pl1 on my machine. When operating text data files, I use file() to read the entire file and then display it. The code is as follows: $message = file("message.txt"); $i=0; for($i=0;$i It is completely normal on my machine, but when I uploaded it to the server, I found that , originally one row of data was displayed as 2 rows, and there were originally 10 rows of data, but the result was displayed as 15 rows! It turns out that in some versions of php (less than php4.0.0), the string of this method cannot exceed 8190 characters. I also found the same explanation in the feedback about file() on php.net , the original English text is as follows: In PHP 4.0.0 and lower, array elements are never longer than 8190 characters. Longer lines are split. This limitation was removed in PHP 4.0.1

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/531785.htmlTechArticleAbout the abnormal line break error that occurs when using file() to read the entire file! I currently use php 4.03pl1 natively and use file() to read the entire file when operating on text data files, and then...
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