PHP file_get_contents() 函數 |
發布時間: 2012/9/1 16:36:03 |
定義和用法file_get_contents() 函數把整個文件讀入一個字符串中。
和 file() 一樣,不同的是 file_get_contents() 把文件讀入一個字符串。
file_get_contents() 函數是用于將文件的內容讀入到一個字符串中的首選方法。如果操作系統支持,還會使用內存映射技術來增強性能。
語法file_get_contents(path,include_path,context,start,max_length)
說明對 context 的支持是 PHP 5.0.0 添加的。 提示和注釋注釋:本函數可安全用于二進制對象。 例子<?php print_r(file("test.txt")); ?> 輸出: Array ( [0] => Hello World. Testing testing! [1] => Another day, another line. [2] => If the array picks up this line, [3] => then is it a pickup line? ) 本文出自:億恩科技【www.vbseamall.com】 |