drmcm84800
drmcm84800
2012-06-26 09:12

将JSON字符串或数组转换为Excel文件?

已采纳

How can I convert the array/json into an Excel file (Office Open XML)?

$result = mysql_query($query);
$rows = Array();
while($row = mysql_fetch_assoc($result)) {
    array_push($rows, $row);
}
echo json_encode(Array(
    "data" => $rows
));
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

2条回答

  • doujuchuan9915 doujuchuan9915 9年前

    For handling office open xml (.xlsx) files you can use PHP-Excel

    Tutorials are here

    点赞 评论 复制链接分享
  • douzhang3822 douzhang3822 2年前

    The PHP-Excel has not be maintained for years and must not be used anymore. All users must migrate to its direct successor PhpSpreadsheet
    PhpSpreadsheet is the next version of PHPExcel.

    点赞 评论 复制链接分享