English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

PHP Basic Tutorial

PHP Advanced Tutorial

PHP & MySQL

PHP Reference Manual

PHP fclose() function usage and example

PHP Filesystem 参考手册

The fclose() function closes all open files. If successful, it returns true; if unsuccessful, it returns false.

Syntax

bool fclose ( resource $handle )

The file pointer must be valid and must point to a file that was successfully opened by the fopen() or fsockopen() function.

Online example

<?php
   $handle = fopen("/PhpProject/sample.txt", "r");
   fclose($handle);
   echo "File closed succsssfully";
?>

Output result

File closed succsssfully

PHP Filesystem 参考手册