Skip to content
chriso edited this page Sep 8, 2011 · 3 revisions

Add a route for 404 as your last route. If no other routes are matched, the specified callback will be called.

<?php
respond('404', function ($request) {
    $page = $request->uri();
    echo "Oops, it looks like $page doesn't exist..\n";
});

But I need some other route(s) for setting up layouts, etc.

If you don't want a certain respond() call to be counted as a match, just call it without a route:

<?php
respond(function ($request, $response, $app) {
    $response->layout('layout.phtml');
    //etc.
});
Clone this wiki locally