PHP5入门之读写文本文件
                        
                            时间:2021-07-01 10:21:17
                            帮助过:13人阅读
							                        
                     
                    
                    | ===============写文件===============$realFiePath = "D:/test.txt";$fileContent = "Test 2011 03 12."; $file = fopen($realFiePath, 'wb');fwrite($file, $fileContent );fclose($file); ===============读文件===============$realFiePath = "D:/test.txt";$size = intval(sprintf("%u", filesize($realFiePath)));$handle = fopen($realFiePath, "rb");$fileContent = "";   while (!feof($handle)) {      $fileContent .= fread($handle, $size);      ob_flush();       flush();   }  fclose($handle); echo $fileContent ;
 |