10 articles about phpfseek () functions are recommended.

Source: Internet
Author: User
Tags 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 (... 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. 10 articles about php feof () functions are recommended.

Introduction: php can use the file function and fseek function to read large files, but the efficiency between the two may be different, this article introduces how to use the php file function and fseek function to compare and analyze the reading efficiency of large files. For more information, see.

6. resumable Upload allows PHP to support source code for resumable Upload.

Introduction: resumable Upload allows PHP to support source code for resumable Upload: for example, the first request for a file is from 0 to 999 bytes, the second request is from 1000 to 1999 bytes, and so on, each time a 1000-byte content is requested, the program uses the fseek function to obtain the corresponding file location and then outputs it. The code is as follows: $ fname = './05e58c19552bb26b158f6621a6650899'; $ fp = fopen ($ fname, 'RB'); $ fsize = filesize ($ fname); if

7. http://www.12306.cn/mormhweb/ php file generation

Introduction: http://www.12306.cn/mormhweb/:http://www.12306.cn/mormhweb/ php file generation:

8. the simplest PHP program of the stenographer-the stenographer

Introduction: Calculator: The simplest PHP program of the calculator-calculator: Principle: 1. the first user browses a page. 2. the number of times the server program reads the page from the database or file. 3. store the number of times and send it back to the first user. 4. the second user browsed a page. 5. the number of times the server program reads the page from the database or file. 6. store the number of times and send it back to the second user. Functions to be understood: fopen () open the file filesize () to get the file size fseek () move the file pointer fgets () to get the file pointer

9. php file generation _ PHP Tutorial

Introduction: php generates files .? Functionrw_counterfile () {$ fp = fopen ("counter.txt", "r +"); if ($ fp = NULL) echo "file processing error"; rewind ($ fp ); // move the pointer to the file header fseek ($ fp, 2); // move the pointer back 2 $ point = ftell ($

10. PHP code for reading and modifying a line of content in a large file _ PHP Tutorial

Introduction: PHP reads and modifies the code of a line of content in a large file. The code is as follows: $ fp = fopen ('d:/file.txt ', 'R +'); if ($ fp) {$ I = 1; while (! Feof ($ fp) {// modify the second row of data if ($ I = 2) {fseek ($ fp, 2, SEEK_CUR); fwrite ($ fp ,'#'

[Related Q & A recommendations ]:

In php, a string is inserted at the last 140 bytes of the file, but the file pointer is always at the end of the file.

Web-method for uploading images with external links directly to youpai cloud space (PHP)

SEEK_CUR of the c language fseek function

The above is a detailed article about the php fseek () function. For more information, see other related articles in the first PHP community!

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.