14use UnexpectedValueException;
35 if ($request->
getMethod() ===
'OPTIONS') {
41 case 'application/json':
46 case 'application/xml':
55 throw new UnexpectedValueException(
'Cannot render unknown content type ' .
$contentType);
59 $body =
new Body(fopen(
'php://temp',
'r+'));
84 return '{"message":"Not found"}';
94 return '<root><message>Not found</message></root>';
106 $homeUrl = (string)($request->
getUri()->withPath(
'')->withQuery(
'')->withFragment(
''));
110 <title>Page Not Found</title>
115 font:12px/1.5 Helvetica,Arial,Verdana,sans-serif;
124 display:
inline-block;
130 <h1>Page Not Found</h1>
132 The page you are looking
for could not be found. Check the address bar
133 to ensure your URL is spelled correctly. If all
else fails, you can
134 visit our home page at the link below.
136 <a href=
'$homeUrl'>Visit the Home Page</a>
An exception for terminatinating execution or to throw for unit testing.
Abstract Slim application handler.
determineContentType(ServerRequestInterface $request)
Determine which content type we know about is wanted using Accept header.
Default Slim application not found handler.
renderXmlNotFoundOutput()
Return a response for xml content not found.
renderHtmlNotFoundOutput(ServerRequestInterface $request)
Return a response for text/html content not found.
renderJsonNotFoundOutput()
Return a response for application/json content not found.
renderPlainNotFoundOutput()
Render plain not found message.
__invoke(ServerRequestInterface $request, ResponseInterface $response)
Invoke not found handler.
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\s+" &#(? foreach( $entity_files as $file) $output
getUri()
Retrieves the URI instance.
getMethod()
Retrieves the HTTP method of the request.
Representation of an outgoing, server-side response.
Representation of an incoming, server-side HTTP request.
if( $path[strlen( $path) - 1]==='/') if(is_dir($path)) if(!file_exists( $path)) if(preg_match('#\.php$#D', $path)) $contentType
Slim Framework (https://slimframework.com)