PHP读取大文件进行数据分析统计

f h = f o p e n ( fh = fopen( url,‘rb’);
fgets($fh);
i n s = a r r a y ( ) ; w h i l e ( ! f e o f ( ins = array(); while(!feof( fh)){
r s = t r i m ( f g e t s ( rs = trim(fgets( fh));
$rs = explode(’,’, r s ) ; i f ( c o u n t ( rs); if(count( ins) == 500){
self::addRequestData( i n s ) ; u n s e t ( ins); unset( ins);
$ins = array();
}
}
注意 ignore_user_abort() 的使用
注意 memory_limit的限制

猜你喜欢

转载自blog.csdn.net/weixin_41612889/article/details/89134859