PHP fclose() 函數(shù)
定義和用法
fclose() 函數(shù)關(guān)閉一個(gè)打開(kāi)文件。
語(yǔ)法
fclose(file)
參數(shù) | 描述 |
---|---|
file | 必需。規(guī)定要關(guān)閉的文件。 |
說(shuō)明
file 參數(shù)是一個(gè)文件指針。fclose() 函數(shù)關(guān)閉該指針指向的文件。
如果成功則返回 true,否則返回 false。
文件指針必須有效,并且是通過(guò) fopen() 或 fsockopen() 成功打開(kāi)的。
例子
<?php
$file = fopen("test.txt","r");
//執(zhí)行的一些代碼...
fclose($file);
?>