【发布时间】:2013-06-14 06:10:25
【问题描述】:
我正在阅读两个 excel 文件,使用 php-excel-reader (From this)
读取第一行的两个文件后,我正在比较它。如果它们相同,那么我会将包含的文件附加到其他文件中。写我正在使用的文件this
现在我想关闭一个文件,但该功能在 php-excel-reader 中不可用
这是我的代码
compare file
{
$data = new Spreadsheet_Excel_Reader($filepath);
$data1 = new Spreadsheet_Excel_Reader($destinationfilepath);
}
unset($data);
unset($data1);
if($flag==0)
{
$excel = new ExcelWriter($destinationfilepath);
// read the source file
$finalarray= array();
for($m=1;$m<$sourcefilerowcount;$m++)
{
$charvalue='A';
$temprow=$m+1;
for($n=0;$n<$destinationcolnum;$n++)
{
$data = new Spreadsheet_Excel_Reader($filepath);
$finalarray[$n]=$data->val($temprow,$charvalue);
$charvalue++;
}
print_r($finalarray)."<br/>";
$excel->writeLine($finalarray);
}
【问题讨论】:
-
我猜它在代码中
$excel->close();http://www.vijayjoshi.org/2009/12/15/how-to-create-excel-files-in-php/ -
ya.but 对于 php-excel-reader 我没有得到。 $data1 = new Spreadsheet_Excel_Reader($destinationfilepath);如何关闭 $data1 ?
-
@2492230 你可以使用
unset($data1); -
谢谢。我试过这个。但我的数据没有复制到其他文件中。我将上传我的代码
-
与其使用两个不同且不兼容的包来读取 Excel 和编写 Excel,不如寻找一个既可以读取又可以写入 Excel 文件的包......就像你的 PHPExcel 包已列在您的标签中