trying to figure out a simple task. It is necessary when addressing the url to sort the data, having received a line at the output, write to a file and give it for downloading. The array is formed from the request to the database, then it is moved. The result is such a structure
foreach ($allRes as $row){ foreach ($row as $k => $v){ if($k != 'section_id') { $str.= $v . $col_delimiter. ' - ' . $count; } } $count++; $str .= $row_delimiter; } The result is a line with hyphenation.
I did it, everything works, but not all lines get into the downloaded file.
header('Content-Disposition: attachment; filename="str.txt"'); header('Content-Type: text/plain'); header('Content-Length: ' . strlen($str)); header('Connection: close'); echo $str; Can anyone come across?
$str, how is this value formed? Also, when working with data in an encoding such as utf-8,strlenwill give the wrong value. - u_mulder 2:46 pmforeach ($allRes as $row){ foreach ($row as $k => $v){ if($k != 'section_id') { $resSrt .= $v . $col_delimiter. ' - ' . $count; } } $count++; $str.= $row_delimiter; }over an array in str, I write theforeach ($allRes as $row){ foreach ($row as $k => $v){ if($k != 'section_id') { $resSrt .= $v . $col_delimiter. ' - ' . $count; } } $count++; $str.= $row_delimiter; }linesforeach ($allRes as $row){ foreach ($row as $k => $v){ if($k != 'section_id') { $resSrt .= $v . $col_delimiter. ' - ' . $count; } } $count++; $str.= $row_delimiter; }foreach ($allRes as $row){ foreach ($row as $k => $v){ if($k != 'section_id') { $resSrt .= $v . $col_delimiter. ' - ' . $count; } } $count++; $str.= $row_delimiter; }foreach ($allRes as $row){ foreach ($row as $k => $v){ if($k != 'section_id') { $resSrt .= $v . $col_delimiter. ' - ' . $count; } } $count++; $str.= $row_delimiter; }mb_internal_encoding("UTF-8");header('Content-Disposition: attachment; filename="ads.txt"'); header('Content-Type: text/plain'); header('Content-Length: ' . strlen($str)); header('Connection: close'); echo $str;Code without receiving data. - Alexmb_strlenadded only 100, but still not all. - Alex