10 articles about the phpfclose () function are recommended.

Source: Internet
Author: User
Example of a file handle: you can use the handle to locate the starting position of a file that has not been read and block reading of large files. to use the read file function, you need to use the path relative to the PHP script to indicate the file to be read, however, most PHP file functions use a slightly different mechanism to access files. this mechanism is very similar to the mechanism for connecting to the database. in this process, the fopen () function is used for "connection ", use the fclose function to "disconnect ". The return value of the fopen function is a PHP file pointer, also known as a file handle... example of a file handle: you can use the handle to locate the starting position of a file that has not been read and block reading of large files. to use the read file function, you need to use the path relative to the PHP script to indicate the file to be read, however, most PHP file functions use a slightly different mechanism to access files. this mechanism is very similar to the mechanism for connecting to the database. in this process, the fopen () function is used for "connection ", use the fclose function to "disconnect ". The return value of the fopen function is a PHP file pointer, also known as a file handle. once you have a file handle, you can use it to perform a variety of operations on the file, including removing and attaching operations, so what problems should I pay attention to when using this handle? First, let's take a look at how the file is opened and closed. The code is as follows:

1. 10 articles about php fopen () functions are recommended.

Introduction: <? Php // PHP visitor counter function num () {if (! File_exists ("n.txt") {$ fp = fopen ("n.txt", "w"); fwrite ($ fp, "1"); fclose ($ fp ); $ n = 1 ;...

9. PHP file replication

Introduction: This article describes how to copy files in PHP. For more information about PHP tutorials, see.

10. php get the content under the address through the webpage address php get the webpage content php get the webpage source code php open the net

Introduction: webpage address. php: php obtains the content of this address through the webpage address: Method 1 (for PHP5 and later versions): $ readcontents = fopen ("http://www.phpres.com/index.html ", "rb"); $ contents = stream_get_contents ($ readcontents); fclose ($ readcontents); echo $ contents; Method 2: echo file_get_contents ("h

[Related Q & A recommendations ]:

Php-why can't messages be returned after receiving users' images and storing them on their servers?

PHP adds content for example and replaces all content in a.txt. How can I append content to the end of a.txt.

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?

Linux-fclose (stdout), how to enable stdout again ???

The above is a detailed article about the php fclose () 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.