PHP制作实时股票交易应用程序
我有一个软件,它给我Excel格式的股票数据,数据每秒自动连续更新。我必须在网页中显示这些数据,就像它们在Excel中显示一样(即网络数据也应该以这样的方式更新)方式)和这些数据。它是如何完成的。
I have a software which give me stock data as excel format , the data is automatically update continuously in every second.i have to show these data in web page such like they are shw in excel (ie the web data should be also update in such manner ) and these data. how it is be done.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
以编程方式将数据导出为 CSV 格式并将其导入关系数据库。
用Web语言提取数据并在网页中显示。这些步骤的教程都应该可用。
要将 xls 转换为 csv,请参阅问题...
在没有 GUI 的情况下将 Excel (xls) 文件转换为逗号分隔 (csv) 文件
对于第二部分,您可以让 cron 作业运行读取 csv 的 PHP 脚本文件内容并将其插入数据库。这方面也有很多线索。
要显示、从数据库中选择并适当地设置格式,可以遵循网上有关此部分的任何基本教程。
如果您遇到困难,请发布您的代码:)
Programatically export the data into CSV format and import it into a relational database.
Extract the data with web language and display in webpage. Tutorials for these steps should all be available.
To convert from xls to csv see the question...
converting an Excel (xls) file to a comma separated (csv) file without the GUI
For the second part, you can have a cron job run a PHP script that reads in the csv file contents and inserts this into a database. Plenty of threads on this also.
To display, select from database and format appropriately, can follow any of the basic tuts on the net for this part.
Post your code if you get stuck :)
正如您所知道的,使用 PHPExcel 读取 Excel 文件。
然而,每秒刷新数据会给你的服务器带来非常重的负载。
我建议您使用 Comet 技术来使用服务器端推送。查看 Meteor 服务器。
您将完成“持久”连接,因此服务器会将数据推送到客户端,并且每秒刷新页面或创建ajax请求的需要将消失。
As you've been told, use PHPExcel to read Excel file.
However, refreshing data every second is gonna make a very heavy load on your server.
I'd recommend you rather use server side push using Comet technologies. Take a look at Meteor server.
You will accomplish 'persistent' connection, so server will push data to the client, and the need to refresh the page or create ajax request every second will be gone.
您已标记此 PHP,因此我假设这是您选择的脚本语言:使用 PHPExcel 读取 Excel 文件并将其以 HTML 格式写入您的网页。 PHPExcel 的 HTML Writer 将保留原始 Excel 工作簿的所有样式和格式。
然而,对于网页和脚本语言来说,每秒更新一次是相当极端的。不要在请求页面时读取 Excel 文件,而是将其作为后台任务运行,每当收到 Excel 文件时将 Excel 转换为静态 HTML 文件,并提供最新的静态 HTML。
如果需要这种极端的时机,那么您可能最好考虑编译语言,甚至非 Web 解决方案。
You've tagged this PHP, so I assume that's your scripting language of choice: use PHPExcel to read the Excel file and write it out as formatted HTML to your web page. PHPExcel's HTML Writer will retain all the style and formatting of the original Excel workbook.
However, an update every second is pretty extreme for a web page, and for a scripting language. Rather than reading the Excel file whenever the page is requested, run this as a background task converting the Excel to a static HTML file whenever an Excel file is received, and serve the latest static HTML.
If this extreme timing is needed, then you might be better looking at a compiled language, or even a non-web solution.