使用 PHP 显示基于 CSV 的图表
抱歉,我是网络语言新手。我正在尝试上传 CSV 文件,解析第二列和第七列,并将其输出到 Google Graphs API。这是我第一次尝试使用 PHP 做任何事情,所以,一个例子对我来说会很好地分析,但是,我也可以尝试通过文档来弄清楚所有事情。
非常感谢您以任何方式提供的帮助。
Sorry, I'm a n00b to web languages. I'm trying to upload a CSV file, parse the second and seventh columns, and output it to the Google Graphs API. This is my first ever time trying to do anything with PHP, so, a example would be nice for me to analyze, but, I can try to figure out everything with documentation as well.
Thank you so much for help in any way.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
以下是使用 PHP 上传文件的方法: http://de3.php.net/move_uploaded_file
解析 CSV 文件很简单:
如果您随后循环遍历
$csv
,您将在$csv[$iterator][1]
和$ 中看到第二列和第七列csv[$迭代器][6]
。我没有使用过 Google Graph API,所以我无法帮助你。
here's how you can upload a file with PHP: http://de3.php.net/move_uploaded_file
Parsing a CSV file is easy:
If you then loop through
$csv
you have the second and seventh column in$csv[$iterator][1]
and$csv[$iterator][6]
.I haven't used Googles Graph API, so I can't help you with that.
如果您不熟悉 Google 图表,请尝试 highcharts。我已经用过它很多次并且非常喜欢它。他们也有一些教程和很好的示例代码可供查看。
检查解析 CSV 文件的其他响应;这是正确的。
If you're not married to google graphs, try highcharts. I've used it on several occasions and really like it. They have some tutorials and good sample code to look at, too.
Check the other response for parsing a CSV file; it's spot on.
有一个组件旨在通过上传 CSV 文件轻松实现图表: Graph来自 CSV 文件
There is a component designed to easily implement the graph by uploading the CSV file: Graph from CSV file