How to use php rewind function

青灯夜游
Release: 2023-02-22 21:40:02
Original
2664 people have browsed it

The rewind() function is a built-in function in PHP that is used to set the position of the file pointer to the beginning of the file. The syntax is rewind(file), and if successful, the function returns TRUE. On failure, returns FALSE.

How to use php rewind function

#php How to use the rewind() function?

php The rewind() function rewinds the position of the file pointer back to the beginning of the file.

Syntax:

rewind(file)
Copy after login

Parameters: The rewind() function accepts one parameter.

● File: required. Specifies an open file.

Return value: If successful, this function returns TRUE. On failure, returns FALSE.

Description: The rewind() function generates an E_WARNING level error when it fails. If the file is opened in append mode, the data written will be appended regardless of the position of the pointer.

php rewind() function example

<?php
$file = fopen("test.txt","r");
//更改文件指针的位置
fseek($file,"15");
//将文件指针设置为0
rewind($file);
fclose($file);
?>
Copy after login

The above is the detailed content of How to use php rewind function. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!