PHP advanced application for PHP file processing allows you to locate and query file pointers, so as to quickly query required information. file pointer functions include rewind (), fseek (), feof () and ftell () functions. In the previous article "advanced application for PHP file processing-remote file access and file locking", we introduced the remote access to files and how to lock files, let's take a look. I will not talk about it much here. today we will mainly talk about functions in file pointers! I. rewind (... PHP advanced application for PHP file processing allows you to locate and query file pointers, so as to quickly query required information. file pointer functions include rewind (), fseek (), feof () and ftell () functions. In the previous article "advanced application for PHP file processing-remote file access and file locking", we introduced the remote access to files and how to lock files, let's take a look. I will not talk about it much here. today we will mainly talk about functions in file pointers! I. rewind () function this function sets the pointer of the handle file to the beginning of the file stream. the syntax format of this function is as follows: bool rewind (resource $ handle) note: if you open the file and append ("a") mode, any data written to the file will always be appended to the end of the existing content of the file, no matter where the file pointer is located! II. fseek () function fseek () is used to locate file pointers. the syntax format of this function is as follows:
1. php file processing advanced application-file pointer
Introduction: learn how to use various file functions of PHP. View basic file functions such as fopen, fclose, and feof, and read functions such as fgets, fgetss, and fscanf. And one or two lines of code are found to be used to process the entire file. One of the ways to handle modern programming languages such as PHP is that there are plenty of options available. PHP can easily win the Perl motto "There's more...
7. how to use the feof () function to read files in PHP
Introduction: PHP uses the feof () function to read files
8. efficiency of reading php text files from Human Resources and Social Security Department No. 10774
Overview: Human Resources and Social Security Department Document No. 10774: efficiency of reading php text files from Human Resources and Social Security Department Document No. 10774: the homepage is about 3 kB. the code tested locally is as follows: file_get_contents ('shadow. xml '); the code takes 0.0003 seconds: $ indexFile = fopen ('shadow. XML', 'r'); while (! Feof ($ indexFile) fgetc ($ indexFile); code that takes 0.026 seconds is as follows: $ indexFile
9. implementation code for galaxy s4 active to determine the end of HTTP requests in Keep-Alive mode
Introduction: galaxy s4 active: galaxy s4 active determines the implementation code of the end of an HTTP request in Keep-Alive mode: therefore, the end of a request can be determined based on EOF. the following code (PHP) very common: the code is as follows: // $ fp is the handle generated by fsockopen () while (! Feof ($ fp) {echo fgets ($ fp);} (note: The short Connection mode is indicated by "Connection: close" in the header, and the persistent Connection uses "Connection: the keep-alive mark. HTTP/1.0 default
10. fop PHP implements code fopen and curl for reading webpage files
Introduction: fop PHP implements code fopen and curl for reading webpage files: 1. fopen implements code: the code is as follows: The code is as follows:
[Related Q & A recommendations ]:
C ++-why is the WHILE loop unable to read data from each row of the file in sequence?
What does this mean when I open a file and write it to a rb?
What is rb in fopen () l? What is the function of feof?
The above is a detailed article about the php feof () function. For more information, see other related articles in the first PHP community!