doujiong9915 2017-04-05 11:25
浏览 68
已采纳

如何在完成php动作后限制wamp服务器显示空白页?

I'm using Wamp in windows 10 pro. earlier I used to program php in an android device with PAW WEB SERVER app. this app would avoid showing any blank pages. for example if I want to load a file named 'test.html' through this server app in android and this file (i.e 'test.html') has got no content in it and its size is 0 bytes than the server would ignore that file and would remain on the same page that had been opened before. so I need such thing in WAMP server can you help me out?

  • 写回答

2条回答 默认 最新

  • drqvsx1228 2017-04-05 11:34
    关注

    Such behavior of a http server actually is a pretty bold thing to do and kind of violates how web servers should work. A standard server has no concept of "remaining", since http is a stateless protocol. And it certainly should return an empty reply if that is what its internal resources provide.

    Even if you really need such a strange behavior on your server side component and want to rely on a standard http server and you implement your own logic, for example in form of a simple php script which does exactly what you ask, even then you would not get the desired result. Since the server has no means to "nor reply". It has to either send a normal response (which might be empty) or an error status. Such error status however will cause every standard compliant http client to visualize the issue. You'd have to use a non standard compliant http client, again implementing your own logic.

    An alternative is to simply do the http request from client to server in form of an ajax request, so in background. That allows to decide on client side what to actually do with the received response. You can evaluate any potential http status indicator and "ignore" that reply, so not replace the previously loaded view.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 delta降尺度方法,未来数据怎么降尺度
  • ¥15 c# 使用NPOI快速将datatable数据导入excel中指定sheet,要求快速高效
  • ¥15 再不同版本的系统上,TCP传输速度不一致
  • ¥15 高德地图点聚合中Marker的位置无法实时更新
  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程