我正在使用此插件http://www.kunalbabre.com/projects/table2CSV.php中的选项3.1 我怎么能跳过第一行?可以对$ _REQUEST ['csv_text']
进行<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;
?>
答案 0 :(得分:1)
您可以尝试这样的事情: $ _REQUEST [&#39; csv_text&#39;] = preg_replace(&#39; / ^ [^ \ n] * \ n /&#39;,&#39;&#39;,$ _REQUEST [&#39; ; csv_text&#39;]);