方法1:
使用上面所介绍的 header() 函数,来输出 HTML 404 状态码
//by www.qzphp.cn header('HTTP/1.1 404 Not Found'); header("status: 404 Not Found");
方法2: http_response_code():获取/设置响应的 HTTP 状态码
//by www.qzphp.cn http_response_code(404);
注:http_response_code() 函数,只能在高于5.4(包括5.4)的php版本中使用