我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

如何使用localhost尝试除错误404之外的其他HTTP错误

Using localhost server (wamp/xampp), is it possible to try simulate most HTTP errors (400,401,402,500,503(...))?

I've done custom error page using .htaccess and PHP but I can only test for error 404. How about other errors?

There is a function called header in PHP.

See the documentation https://secure.php.net/manual/en/function.header.php

With it you can send a HTTP header to browser.

Or if you have PHP5.4 or greater you can use this:

http://www.php.net/manual/en/function.http-response-code.php

近期文章

  • GetAll私人成员ZendFramework
  • 从套接字输出文本的安全方法。
  • 使用动态字段组管理表单
  • 发出使会话变量起作用的问题
  • php保存的文件下载不是预期的
  • 缺少Symfony2 Bundles资源文件
  • 使用ajax调用更新数据库onclick
  • 安全登录表单,或者至少我希望如此
  • 没有从在线服务器获得json响应
  • 无法通过PHP和MySQL获得接受的请求
  • 尝试获取行数时,PDO上的fetchColumn错误
  • 保存HTML5将元素拖放到db
  • 使用搜索字词更改codeigniter中的网址
  • 使用ajax,PHP和Javascript循环访问JSON文件
  • 基于HTML的更新查询选择选项阵列PHP
  • 如何在PHP中同时运行多个函数
  • Sublime Text自动完成功能,括号中是否有变量?
  • 为什么在多次加载页面时会破坏PHP会话?
  • Php JSONArray解码并执行数据库操作
  • 减少在php中使用$ this伪变量?

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华