dqwh1218 2013-04-23 12:27
浏览 50
已采纳

在PHP中处理服务器上的Excel公式

I have a rather complex spreadsheet formula. Right now I am using PHPExcel to load the spreadsheet into memory, and I set the cell values of the formula input to the values from a front-end form (using ajax), get the calculated result and send it back to the client.

Is this the best way to this? Or should the formulas be converted to pure php?

If this is an okay method, I have concerns regarding concurrency and memory usage.

The spreadsheet isn't that large, less than 1000 cells. How can I calculate the threshold for concurrency (people clicking calculate on the front end) and memory usage on the server?

What steps can I take to optimise this algorithm (caching for example) whilst balancing performance?

  • 写回答

1条回答 默认 最新

  • douren2395 2013-04-23 12:40
    关注

    You're going to have problems doing this as an ajax request for large numbers of concurrent users, because these http requests have no persistence, so you need to load the spreadsheet file for every request. What it does guarantee is that each request runs independently with its own copy of the spreadsheet, so no individual user's request will affect any of the other users requests.

    The other extreme is to take all the Excel logic and rewrite it in PHP. You don't give any indication of the complexity of your spreadsheet formulae, so it's difficult to judge how complex a task this would be.

    A third option would be to use only PHPExcel's calculation engine, feeding it with the form values and formulae directly. This eliminates the time and memory overheads of loading the spreadsheet file with every request, so could be the easiest and most efficient option. You can find an example of this in the Quadratic2.php example file in the /Tests directory of the PHP distribution.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

悬赏问题

  • ¥15 IBMP550小型机使用串口登录操作系统
  • ¥15 关于#python#的问题:现已知七自由度机器人的DH参数,利用DH参数求解机器人的逆运动学解目前使用的PSO算法
  • ¥15 发那科机器人与设备通讯配置
  • ¥15 Linux环境下openssl报错
  • ¥15 我在使用VS编译并执行之后,但是exe程序会报“无法定位程序输入点_kmpc_end_masked于动态链接库exe上“,请问这个问题有什么解决办法吗
  • ¥15 el-select光标位置问题
  • ¥15 单片机 TC277 PWM
  • ¥15 在更新角色衣服索引后,Sprite 并未正确显示更新的效果该如何去解决orz(标签-c#)
  • ¥15 VAE代码如何画混淆矩阵
  • ¥15 求遗传算法GAMS代码
手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部