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