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 pip install后修改模块路径,import失败,需要在哪里修改环境变量?
  • ¥15 爬取1-112页所有帖子的标题但是12页后要登录后才能 我使用selenium模拟登录 账号密码输入后 会报错 不知道怎么弄了
  • ¥30 关于用python写支付宝扫码付异步通知收不到的问题
  • ¥50 vue组件中无法正确接收并处理axios请求
  • ¥15 隐藏系统界面pdf的打印、下载按钮
  • ¥15 MATLAB联合adams仿真卡死如何解决(代码模型无问题)
  • ¥15 基于pso参数优化的LightGBM分类模型
  • ¥15 安装Paddleocr时报错无法解决
  • ¥15 python中transformers可以正常下载,但是没有办法使用pipeline
  • ¥50 分布式追踪trace异常问题