读出文件中的数据2
2019獨角獸企業重金招聘Python工程師標準>>>
<?php//file(),接收參數為文件名(不是句柄),將文件以“行”分組傳入一個數組,返回值為數組 $filePath = '/Users/Cuffica/Desktop/addicted.rtf'; $array = file($filePath); echo $array; print_r($array);echo '<br />'; echo '<br />';//readfile()讀出整個文件內容(包含輸出到瀏覽器的功能),注意與fpassthru()區分(當前指針后讀剩余的) readfile($filePath); echo readfile($filePath); //返回值int型,文件總字節數echo '<br />'; echo '<br />';echo file_get_contents($filePath); //讀入數據到緩沖區,然后通過echo打印,無需打開關閉文件;需要php5以上支持?>
轉載于:https://my.oschina.net/cuffica/blog/72784
總結
- 上一篇: Excel Oledb设置
- 下一篇: 【博客话题】技术生涯中的出与入