php - php文件功能不适用于长csv文件
问题描述
我在用:
$csv = file($filePathTest);
其中 $filePathTest 是此 csv 的路径:
policyID,statecode,county,eq_site_limit,hu_site_limit,fl_site_limit,fr_site_limit,tiv_2011,tiv_2012,eq_site_deductible,hu_site_deductible,fl_site_deductible,fr_site_deductible,point_latitude,point_longitude,line,construction,point_granularity
119736,FL,CLAY COUNTY,498960,498960,498960,498960,498960,792148.9,0,9979.2,0,0,30.102261,-81.711777,Residential,Masonry,1
448094,FL,CLAY COUNTY,1322376.3,1322376.3,1322376.3,1322376.3,1322376.3,1438163.57,0,0,0,0,30.063936,-81.707664,Residential,Masonry,3
206893,FL,CLAY COUNTY,190724.4,190724.4,190724.4,190724.4,190724.4,192476.78,0,0,0,0,30.089579,-81.700455,Residential,Wood,1
并且 file($filePathTest) 的结果是正确的:
(array) [4 elements]
0: (string) "policyID,statecode,county,eq_site_limit,hu_site_limit,fl_site_limit,fr_site_limit,tiv_2011,tiv_2012,eq_site_deductible,hu_site_deductible,fl_site_deductible,fr_site_deductible,point_latitude,point_longitude,line,construction,point_granularity
"
1: (string) "119736,FL,CLAY COUNTY,498960,498960,498960,498960,498960,792148.9,0,9979.2,0,0,30.102261,-81.711777,Residential,Masonry,1
"
2: (string) "448094,FL,CLAY COUNTY,1322376.3,1322376.3,1322376.3,1322376.3,1322376.3,1438163.57,0,0,0,0,30.063936,-81.707664,Residential,Masonry,3
"
3: (string) "206893,FL,CLAY COUNTY,190724.4,190724.4,190724.4,190724.4,190724.4,192476.78,0,0,0,0,30.089579,-81.700455,Residential,Wood,1"
问题是,当我使用 36000 行的大 csv 文件时,函数 file($filePathTest) 无法正确返回包含所有 csv 的单个元素的数组。我无法理解为什么!
(array) [1 element]
0: (string)"All the csv file inside here "
解决方案
推荐阅读
- python - 如何用张量 np.concatenate 列表?
- powershell - 根据文件名移动文件
- r - 如何在环境中运行任意表达式,将所有结果存储在环境中?
- c# - 具有堆栈的项目的 Azure devops 管道任务:selenium、c#、Nunit、边缘浏览器
- python-3.x - 终端中的 Buildozer 服务垃圾邮件
- random - random.seed 在使用 Spyder 的 Python 3.9.7 中不起作用
- android - Picutre 未出现在警报对话框中
- javascript - 从 HTML 字符串中删除标签和
- sql-server - 如何在 SQL Server 中授予用户 CREATE DATABASE 选项?
- python - 如何从一个主异步进程启动多个异步进程