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>
foreach($paths as $path) $request
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.
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', mb_strtolower($path, 'UTF-8'))) $contentType
all(array $promises)
This file contains a set of functions that are useful for dealing with the Promise object.
Slim Framework (https://slimframework.com)