2014-09-05 191 views
0

我從此插件使用選項3.1 http://www.kunalbabre.com/projects/table2CSV.php 我怎麼能跳過第一行?難道是做給$ _REQUEST [ 'csv_text']table2CSV跳過第一行

<form action="getCSV.php" method ="post" > 
<input type="hidden" name="csv_text" id="csv_text"> 
<input type="submit" value="Get CSV File" onclick="getCSVData()"> 
</form> 

<script> 
function getCSVData(){ 
var csv_value=$('#example1').table2CSV({delivery:'value'}); 
$("#csv_text").val(csv_value); 
} 
</script> 

<?php 
header("Content-type: application/octet-stream"); 
header("Content-Disposition: attachment; filename=\"my-data.csv\""); 
$data=stripcslashes($_REQUEST['csv_text']); 
echo $data; 
?> 

回答

1

你可以嘗試這樣的: $ _REQUEST [ 'csv_text'] =的preg_replace('/^[^ \ n] * \ N/','',$ _REQUEST ['csv_text']);

+0

這工作完美謝謝。 – Hector 2014-09-08 13:43:24