我在 PHP 中使用 strstr() 删除从 MYSQL 数据库中提取的值以输出到 excel 文件-
代码:
If (!strstr($value, '<script>')){
$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($col, $row, $value);
$row++;
}
此代码不包括包含<script>
标签的列。然而,它将单元格的内容向上移动,如下所示:
=====================================
|Question | Answer |
=====+========+===============+=====|
| Male/female | |
|----+--------+---------------+-----|
| | F |
|----+--------+---------------+-----|
相反,我希望它像这样跳过行:
=====================================
|Question | Answer |
=====+========+===============+=====|
| | |
|----+--------+---------------+-----|
| Male/female | F |
|----+--------+---------------+-----|