About the exception breaking error occurred while using file () to read the entire file! I haven't tried it, but it's best to read the file.

Source: Internet
Author: User
Error about using file () to read the entire file with an exception to break the error!

I am now using PHP 4.03pl1 to read the entire file using file () when manipulating the text data file, and then display the code as follows:

?
$message = File ("Message.txt");
$i = 0;
for ($i =0; $i <count ($message); $i + +)
{
echo $i. "
". $message;
$i + +;
}
?>

It's completely normal on my machine, but when I uploaded it to the server, I found that the data on the line was displayed as 2 lines, and there were 10 rows of data, and the result was 15 lines! It turns out that in some versions of PHP (less than php4.0.0), the string for this method cannot be more than 8,190 characters, and I found the same explanation in Php.net's feedback for file (), which reads as follows:

In PHP 4.0.0 and lower, array elements are never longer than 8190. Longer lines are split. This limitation is removed in PHP 4.0.1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.