In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
Today, I will talk to you about how to use the php fread () function. Many people may not know much about it. In order to make you understand better, the editor has summarized the following for you. I hope you can get something according to this article.
The php fread () function is used to read an open file, which can read data of a specified length from the file. When reading length bytes or reading to the end of the file (EOF), it stops reading and returns the read string; syntax "fread ($handle,$length)".
The operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer.
PHP fread () function
The fread () function reads the open file.
The fread () function in PHP can read data of a specified length in an open file, or it can be safely used in binary files. When opening a file on a system that distinguishes binary files from text files, such as Windows, the mode parameter of the fread () function is appended with b. The syntax format of this function is as follows:
Fread ($handle,$length)
Where $handle is the file resource created by the fopen () function; $length is to read up to $length bytes.
The fread () function can read data of a specified length from a file, and when it reads $length bytes or when it reaches the end of the file (EOF), the function stops reading and returns the read string. Returns FALSE if the read fails.
Note that the fread () function reads from the current location of the file pointer. Use ftell () to find the current position of the pointer, and rewind () to play back the pointer position.
[example] use the fread () function to read the contents of the file and output it.
The running results are as follows:
In the above example, a filesize () function is used to get the file size, and the function in the fread () function is to read the entire file.
After reading the above, do you have any further understanding of how to use the php fread () function? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.