Rumah >pembangunan bahagian belakang >tutorial php > php读资料的4中方法
php读文件的4中方法。
fopen
$fp = fopen("download.php","rb"); while(!feof($fp)){ echo "fopen: ".fgets($fp); } fclose($fp);
$lines = file("download.php"); foreach($lines as $line){ echo "file: ".$line; }
$content = file_get_contents("download.php"); echo "get_contents: ".$content;
echo "readfile: "; readfile("download.php"); flush();