[英]while exporting report in excel using php Not working on server but working on localhost?
[英]Delete row in excel while exporting using php
我有一个php文件,我在其中使用数据库将数据导出到excel
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment;Filename=cel.xls");
现在,我想在导出文件之前删除文件的第一行。 谁可以帮我这个事?
您可以尝试此示例代码
if(isset($_POST['Upload'])) {
if(move_uploaded_file($_FILES["file"]["tmp_name"], "files/" . $_FILES["file"]["name"])) {
$file_target="files/" . $_FILES["file"]["name"];
$data->read($file_target);
// $x = 2 indicates second row of the excel sheet //
for($x = 2;$x<=count($data->sheets[0]["cells"]); $x++) {
$first_cell = $data->sheets[0]["cells"][$x][1];
$second_cell = $data->sheets[0]["cells"][$x][2];
$third_cell = $data->sheets[0]["cells"][$x][3];
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.