A detailed description of the file handle

Source: Internet
Author: User
Instance of a file handle: Locating the starting position of the unread read through the handle and chunking the large file in order to use the Read file function, you need to use the path relative to the PHP script to indicate to them the file to read, however, most PHP file functions use a slightly different mechanism to access the file, This mechanism is very similar to the mechanism for connecting to a database, which uses the fopen () function for "Connecting" and "disconnecting" using the Fclose function. 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 the right to go, additional operations, and so on, then this handle in the use of the process need to pay attention to what problems? Let's start by looking at how the file is opened and closed with the following code: <?php$f_fopen = fopen (". /file.txt. "," RB "); Open the file.

1. Instance of a file handle: Locating the starting position of the unread read with a handle and chunking the large file

Summary: In order to use the Read file function, you need to use the path relative to the PHP script to indicate to them which files to read, however, most PHP file functions use a slightly different mechanism to access the file, which is very similar to the mechanism for connecting to a database

2. Python3 file Operation detailed

Summary: File operations steps: Open file, action file, close the file remember: The last to close the file (otherwise there may be unexpected results) Open file file handle = ...

3. Detailed Python3 file operation steps

Description: Open File File handle = Opening (' File path ', ' mode ') specify file encoding file handle = open (' File path ', ' mode ', encoding= ' utf-8 ') to prevent forgetting to close the file, you can use the context Manager to open the file with the File path ', ' mode ') as file handle:

4. PHP unlink () function

Summary: Define and use the unlink () function to delete a file. If successful, returns True, which returns false if it fails. The syntax {code ...} parameter describes the filename required. Specifies the files to be deleted. The context is optional. Specifies the environment for file handles. Context is one of the behaviors of modifiable streams ...

5. PHP Directory php php directory operation PHP mkdir multi-level mesh

Introduction: PHP Directory: Directory operation new directory mkdir (path, permissions, recursive creation) Delete directory rmdir () move (rename) rename () Get directory Contents//Open Directory directory handle = Opendir ()//read directory file name = Readdir (the directory handle) reads the file name sequentially, while moving the handle pointer down, then returns false//close directory Closedir () recursively reads directory contents <?phpshowdir ('.. /..

6. What is Hiberfil.sys file in php file read, write, delete operations in PHP for file and directory operations

Introduction: Hiberfil.sys is what file: Hiberfil.sys is what file in PHP file read, write, delete operation in PHP for file and directory operations: first, the directory operation is about a function read from the directory, Opendir (), Readdir (),   Closedir (), when used is to open the file handle first, and then iterate over the list: Copy code code as follows: <?php $base _dir = "filelist/";   $fso = Opendir ($base _dir); echo $base _dir. "

7. What is ringtones folder PHP create file folder and directory operation code

Introduction: Ringtones is what folder: Ringtones is what folder PHP Create Files folder and directory operation code: First, directory operations are read from the directory function, Opendir (), Readdir (), Closedir (), The use of the time is to open the file handle, and then iterate over the list: Copy code code as follows: <?php $base _dir= "filelist/"; $fso =opendir ($base _dir); echo $base _dir. "

8. PHP Create file (folder) and directory operation code _php tutorial

Introduction: PHP Create files (folders) and directory operation code. First, the directory operation is the function read from the directory, Opendir (), Readdir (), Closedir (), using the time is to open the file handle, and then iteration list: Copy code code is as follows: PHP $base

9. php file read, write, delete operations (PHP file and directory operations) _php tutorial

Introduction: PHP file read, write, delete operation (php in the file and directory operations). One: The directory operation first describes a function read from the directory, Opendir (), Readdir (), Closedir (), when used to open the file handle first, and then iterate over the list: Copy code code as follows

PHP Create file (clip) and directory operation Example _php tutorial

Introduction: PHP Create file (folder) and the operation instance of the directory. First, the directory operation is the function read from the directory, Opendir (), Readdir (), Closedir (), when using the first open the file handle, and then the iteration list: PHP $base _dir=liehuonet/; $fso =open

"Related question and answer recommendation":

php-$fp = Fsockopen ($host, $port, $errno, $ERRSTR, 3) The question of the return value

Java-quartz How do I return the results after a timed job?

Java-How does a log file handle be designed better?

Java-single-instance service solves multi-process write files

The python process stops, and the restart process remains unresolved and can only be killed.

Related Article

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.