Is there any method in HTML or PHP to force-trigger specific HTTP 1.1 errors, such as 404, 403, 400, 500, etc.? I n开发者_如何学Goeed a method to test an .htaccess
setup for error docs on a site on one of my servers.
Check out the header function, example:
header("HTTP/1.0 404 Not Found", TRUE, 404);
Examples: here!
Simply use the header
function, as you would for any other HTTP header.
header("HTTP/1.0 404 Not Found");
die;
You can basically write whatever you want after the status code, it should still work the same.
精彩评论