Excel到PHP数组,可能和如何? [英] Excel to PHP array, possible and how?

查看:83
本文介绍了Excel到PHP数组,可能和如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我想让每行成一个数组。



这可能吗?所以我可以像这样访问第一行订单ID(示例):

  $ array [0] [2] /返回7432 

(如果我们假装实际的第一行给列的前缀不在那里) / p>

应该怎么做?



我的意思是几步。阅读文档,然后将其放入数组

解决方案

将电子表格保存为CSV,然后使用PHP的内置CSV功能。请参阅以下示例代码:



http://php.net/manual/en/function.fgetcsv.php


I have a longer excel file that looks like this:

I would like to make each row into a array.

Is this possible? So i can access the first rows "order id" like this (example):

$array[0][2] // returns 7432

(if we pretend the actual first row that gives prefix for the columns isnt there)

How should it be done?

I mean theres a few steps to it. Reading the document, and then put them into a array

解决方案

Save the spreadsheet as a CSV, then use PHP's built-in CSV functions. See the sample code here:

http://php.net/manual/en/function.fgetcsv.php

这篇关于Excel到PHP数组,可能和如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆