目次

PHP:関数使用例:ファイルシステム:fgets

分類

ファイルシステム

機能

ファイルポインタから 1 行取得します。

sample

ソース

<html>
<head>
<title>t_file_exist.php</title>
<body>
<?php
$file_name ="/home/hoge/public_html/test/test.txt";
$file = fopen($file_name,"r") or die("File Open Error");
$buff = fgets($file);
echo $buff;
?>
</body>
</html>

test.txt

hellow php

出力結果

hellow php