PHP File processing advanced application-file pointer php can implement the positioning of the file pointer and query, so as to achieve the required information fast query, the file pointer function has rewind (), fseek (), feof () and Ftell () function. In the previous article, "PHP File processing advanced Applications-remote file access and lock files" we introduced the remote access to files and how to lock files, not to see the small partners, you can go to see, here is not much to say, today we mainly talk about the function of the file pointer! A: Rewind () function This function sets the pointer of the file handle to the beginning of the file stream, and the syntax of the function is as follows: BOOL Rewind (Resource $handle) Note: If you open the file with append ("a") mode, Then any data written to the file will always be appended to the end of the file, no matter where the file pointer is located! Two: Fseek () function fseek () function implements the positioning of the file pointer, the function syntax format is as follows:
1. About PHP feof () functions 10 articles recommended
Introduction: PHP File processing advanced application-file pointer php can implement the positioning of the file pointer and query, so as to achieve the required information fast query, the file pointer function has rewind (), fseek (), feof () and Ftell () function. In the previous article, "PHP File processing advanced Applications-remote file access and lock files" we introduced the remote access to files and how to lock files, not to see the small partners, you can go to see, here is not much to say, today we mainly talk about the function of the file pointer! A: Rewind (...
2. Advanced Application of PHP file processing-File pointers
Introduction: PHP can implement the positioning of the file pointer and query, so as to achieve the required information fast query, the file pointer function has rewind (), fseek (), feof () and Ftell () function.
3. PHP using the file function, fseek function read large file efficiency comparison analysis
Introduction: This article mainly compares and analyzes PHP uses the file function, the Fseek function reads the large file the efficiency, has the certain reference value, the interest small partner may refer to
4. PHP fseek function Read large file two ways
Introduction: Reading Files in PHP is very simple, but if you read a very large file, how to solve it? We can directly use Fseek to do large file operation, this article introduces you to PHP using the Fseek function to read large files, the need for friends can refer to
5. PHP uses the file function, fseek function to read the large file efficiency analysis
Introduction: PHP read large files can use the file function and the Fseek function, but the efficiency may be different between the two, this article introduces the PHP file function and fseek function to achieve large file reading efficiency comparison analysis, the need for friends can refer to.
6. Breakpoints continue to allow PHP to support the extension of the source of the breakpoint
Introduction: Breakpoint Continuation: Breakpoint continued to allow PHP to support the continuation of the source code: the first request for a file from 0 to 999 bytes, the second request 1000 to 1999 bytes, and so on, each request 1000 bytes of content, and then the program through the Fseek function to obtain the corresponding file location, and then output. Copy the code as follows: $fname = './05e58c19552bb26b158f6621a6650899 '; $fp = fopen ($fname, ' RB '); $fsize = FileSize ($fname); If
7. http://www.12306.cn/mormhweb/php Generate file
Introduction: http://www.12306.cn/mormhweb/:http://www.12306.cn/mormhweb/php Generated files: <? function Rw_counterfile () {$fp =fopen ("Counter.txt", "r+"), if ($fp ==null) echo "File handling Error", Rewind ($FP);//pointer moved to header fseek ($ FP, 2);//The pointer moves backwards by 2 $point =ftell ($FP);//Echo $point. ";"; /FP
8. The simplest PHP program for registers--registers
Introduction: Register: Register the simplest PHP program--Register: Principle: 1. The first user browses a page. 2. The server program reads the number of pages viewed from the database or file. 3. Add the number of times to a store and send it back to the first user. 4. The second user browses a page. 5. The server program reads the number of pages viewed from the database or file. 6. Add the number of times to another store and send it back to the second user. Functions to understand: fopen () Open file FileSize () Get File size fseek () Move file pointer fgets () Get file pointer
9. PHP Generated Files _php tutorial
Introduction: PHP Generated files. Functionrw_counterfile () {$fp =fopen ("Counter.txt", "r+"), if ($fp ==null) echo "File handling Error", Rewind ($FP);//pointer moved to header fseek ($ fp,2);//The pointer moves backwards 2 $point =ftell ($
PHP Read and modify code for a line of large files _php tutorial
Summary: PHP reads and modifies the code for a line of content in a large file. Copy the code as follows: $fp = fopen (' d:/file.txt ', ' r+ '); if ($fp) {$i = 1; while (!feof ($fp)) {//modifies the second row of data if ($i = = 2) {fseek ($fp, 2, Seek_cur) fwrite ($fp, ' # ')
"Related question and answer recommendation":
PHP inserts a string in the last 140 bytes of the file, but the file pointer is always at the end of the file
Web-method for uploading externally linked images directly to and from the Cloud Space (PHP)
The seek_cur problem of C + +-C language fseek function