The following text: This article mainly introduces the PHP file read and write operation related function Summary, this article summarizes fwrite (), Fread (), fgets (), fgetc (), file (), ReadFile () and other functions of the introduction and use
Use the PHP function fgets to read pointer files. PHP function fgets -- read a line from the file pointer. stringfgets (inthandle [, intlength]) reads a line from the file pointed to by handle and returns a line with a maximum length of-1
PHP fgets () function is used to read a row from the file pointer, the function can be combined with the feof function to read the contents of the file, this article to share with you PHP use Fgets () read/Get the file content of a simple example
PHP function Fgets--reading a line from the file pointerstring fgets (int handle [, int length])
Reads a row from the file pointed to by handle and returns a string of up to length-1 bytes in length. Stop after encountering a newline character
In the PHP language, there are many powerful functions that support the language's continuous development, and the pie allows more and more programmers to start choosing the language. PHP function fgets is one of the powerful functions.
PHP
Learn a new php function (2) fgetcsv ()/fgets (), fgetcsvfgets
Reading and Writing files is a common action. There are thousands of functions for reading files, which are complex and simple. The most common and convenient operations are
One day learning a new PHP function (2) fgetcsv ()/fgets ()
File read and write is a frequent action, read the function of the file is thousands of, complex, simple also has. Most commonly used conveniently have file_get_contents (),
fread
and
fgets
the difference between:Fread: Computes the length in byte bits, reads the data at the specified length and number, stops after it encounters the end or completes the specified length read.
Fgets: Full row reads, encounters carriage
File read and write is a frequent action, read the function of the file is thousands of, complex, simple also has. Most commonly used conveniently have file_get_contents (), file_put_conents (), do not need to open the file, close the operation of
Fgets(PHP 4 and PHP 5)Fgets-get the pointer to the line slave fileDescriptionString fgets (resource $ processing [Summary $ length])Get the line from file pointer.ParametersHandleThe file pointer must be valid and must point to a file that
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.