檔案系統函式庫

fread

(PHP3 , PHP4)

fread ---  以位元組方式讀檔

語法 : string fread (int fp, int length)

說明 : 

fread( )從檔案指標fp讀取length個位元組,當length個位元組已讀取或是到達檔案結尾(EOF)時,停止讀取。

Example :

<?php

    // get contents of a file into a string

    $filename = "/usr/local/something.txt";

    $fd = fopen ($filename, "r");

    $contents = fread ($fd, filesize ($filename));

    fclose ($fd);

?>

參考 : fwrite( )  fopen( )  fsockopen( )  popen( )  fgets( )  fgetss( )  fscanf( )  file( )  fpassthru( )


上一頁 首頁 下一頁