php读取文件的各种ss

时间:2014-09-17 13:27:32   收藏:0   阅读:248

博客根据http://www.ibm.com/developerworks/cn/opensource/os-php-readfiles个人总结

获取文件全部内容

以下归类是按平时我们通常的使用方法总结

一次性获取

file_get_contents($path),将整个文件内容写入到一个字符串中

分段获取

$headle = fopen();

fgets($headle,$length);

fread($headle,$length);

feof($headle);//判断文件结尾

截取文件部分内容

file_get_contents($path,$include_path,null,$start,$max_length);
fseek移动指针方法
$headle = fopen();
fseek($headle,$start);//将指针移动到$start位置
fread($headle,$length);

 

原文:http://www.cnblogs.com/xiashuo-he/p/3976807.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!