fclose()介绍

fclose — 关闭一个已打开的文件指针 

语法:

bool fclose  ( resource $handle  )

将 handle 指向的文件关闭。 

参数

  1. handle 文件指针必须有效,并且是通过 fopen()  或 fsockopen()  成功打开的。 

返回值:成功时返回 TRUE , 或者在失败时返回 FALSE 。 

 

fclose()实例

使用fclose()函数关闭一个已经打开的文件指针:

<?
    $file = \"data.txt\";
    /* http://www.manongjc.com/article/1326.html */
    if (file_exists($file)) :
         $fh = fopen($file, \"r\");
         fclose($fh);
    else:
         print \"File $file does not exist!\";
    endif;
?>
收藏 打印