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条)

报告相同问题?

悬赏问题

  • ¥15 往复密封问题的两个问题
  • ¥15 DAC函数和STM32
  • ¥15 任务是接收数据并把数据写入DAC7311,这些代码能实现此功能吗
  • ¥15 分析FP -Growth代码运行内存太大而无法运行的原因
  • ¥20 qtcreat 使用msvc编译器开发软件运行时字体锯齿感严重
  • ¥15 为何显示keyerror fruit
  • ¥15 imageware粗糙度表面
  • ¥15 python使用pulp线性优化时报错
  • ¥15 为什么我的uibot导入py模块出错呀。py文件放在了uibot里对应的python文件夹了,卸了重安也不行
  • ¥15 开源或低价数据中台哪个最好