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 latex投稿显示click download
  • ¥15 请问读取环境变量文件失败是什么原因?
  • ¥15 在若依框架下实现人脸识别
  • ¥15 网络科学导论,网络控制
  • ¥100 安卓tv程序连接SQLSERVER2008问题
  • ¥15 利用Sentinel-2和Landsat8做一个水库的长时序NDVI的对比,为什么Snetinel-2计算的结果最小值特别小,而Lansat8就很平均
  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?