0

csv 文件包含 37,000 行,但最多只能显示 22,000 行

$csv = fopen('1'.'.csv','r') or die("can't find file");
echo "<table border=1 >";
echo "<tr><th>ID</th><th>Title</th><th>Gender</th><th>First</th><th>Middle</th><th>Last</th><th>Country Code</th><th>Primary Number</th><th>Secondary Number</th><th>Primary Address</th><th>Address 2</th><th>Address 3</th><th>City</th><th>State</th><th>Country</th><th>Zip</th><th>Email</th><th>Date of Birth</th><th></th><th>Bussiness Name</th><th>Business Number</th><th>Business Fax</th><th>Business Address</th><th>Business City</th><th>Business State</th><th>Businsess State</th><th>Notes</th></tr>";                                       
while($csv_line = fgetcsv($csv,0)) {

if($id == 0){
list($column[0], $column[1], $column[2], $column[3], $column[4], $column[5], $column[6], $column[7],$column[8], $column[9], $column[10], $column[11], $column[12], $column[13], $column[14], $column[15],$column[16], $column[17], $column[18], $column[19], $column[20], $column[21], $column[22], $column[23], $column[24]) = $csv_line;
//===TO LOWER=====
for($col_n = 0;$col_n <= $arr_count; $col_n++) {
$col_lower[$col_n] = strtolower($column[$col_n]);
}
//===SORT VALUE=====
echo 
'<tr><td>CODE:</td><td>';
for($col_n = 0;$col_n <= 16; $col_n++) {
echo $sort[$col_n].'</td><td>';
}
echo'</td><td>';
for($col_n = 17;$col_n <= $arr_count; $col_n++) {
echo $sort[$col_n].'</td><td>';
}
echo '</td></tr>';

    for($col_n = 0;$col_n <= $arr_count; $col_n++) {
        for($sort_n = 0;$sort_n <= $arr_count; $sort_n++) {
            if($sort[$col_n] == $col_lower[$sort_n]){
               $col[$col_n] = $sort_n;
            }
        }
    }   

}

if($id > 0){
list($column[0], $column[1], $column[2], $column[3], $column[4], $column[5], $column[6], $column[7],$column[8], $column[9], $column[10], $column[11], $column[12], $column[13], $column[14], $column[15],$column[16], $column[17], $column[18], $column[19], $column[20], $column[21], $column[22], $column[23], $column[24]) = $csv_line;
//===ECHO=====

echo 
'<tr><td>'.
$id.'</td><td>';
for($col_n = 0;$col_n <= 16; $col_n++) {
$data = ucwords(strtolower($column[$col[$col_n]]));
echo $data.'</td><td>';
}
echo  '</td><td>';
for($col_n = 17;$col_n <= $arr_count; $col_n++) {
$data = ucwords(strtolower($column[$col[$col_n]]));
echo $data.'</td><td>';
}
echo '</td></tr>';  
}
$id++;  



}
echo "</table>";
}
4

1 回答 1

1

找到了答案:

ini_set('memory_limit', '512M');
ini_set('max_execution_time', '180');

在您的 php 文件顶部添加此行以调整执行时间和内存限制。

于 2013-05-27T12:23:02.163 回答