douya2007 2017-05-03 08:07
浏览 31
已采纳

连续显示php浏览器内容

I'm currently migrating a webpage to a new server from php 5.0.x to php 5.6

Now I got one page that loops a Database query 7 times and the results are loaded into a table. I know that this is not the best way of doing things but it works quite well and I currently don't have other options to work on that because the results come from different databases. Caching is not an option because I need the content always up to date.

From accessing the site until it is displayed it takes around three to four seconds.. The queries got optimized recently but still take a long time to get executed.

To my problem: The old webserver shows the result table by table, so the user see's that the page is already working on it's request. When the content of Table1 is loaded, it gets displayed and the server cares for the second resultset.

The new webserver generates the website at once and the content is not shown until the 7 resultsets are loaded and the data is mapped to the grids.

Is there an option, maybe in php.ini with that i can reach the same result as on the old webserver? I really dunno how to google it so I'm asking you guys.

On the other hand maybe there's an option to run all the queries at once (multithreading?) and not in sequence?

Sorry for my "improvable" english.

  • 写回答

1条回答 默认 最新

  • douhui3760 2017-05-03 08:32
    关注

    It's probably something related to output buffering. You can force to write buffer contents out to the client with ob_flush function, just add a call to ob_flush after query execution.

    php.ini setting is output_buffering. Also check output_compression setting, as it can cause problems with buffer flush.

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

报告相同问题?

悬赏问题

  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
  • ¥15 乘性高斯噪声在深度学习网络中的应用