when i run those code
<?php
use Phalcon\Mvc\Micro;
$app = new Micro();
$app->get(
'/orders/display/{name}',
function ($name) {
echo "<h1>This is order: {$name}!</h1>";
}
);
$app->handle();
when i try to visit "/orders/display/hello" error occurred
Fatal error: Uncaught Phalcon\Mvc\Micro\Exception: Not-Found handler is not callable or is not defined in /home/vagrant/test-phalcon/index.php:14 Stack trace: #0 /home/vagrant/test-phalcon/index.php(14): Phalcon\Mvc\Micro->handle() #1 {main} thrown in /home/vagrant/test-phalcon/index.php on line 14
so i add some code like this
$app->notFound(
function () use ($app) {
$app->response->setStatusCode(404, 'Not Found');
$app->response->sendHeaders();
$message = 'Nothing to see here. Move along....';
$app->response->setContent($message);
$app->response->send();
}
);
Try to visit "/orders/display/hello", then the page display
Nothing to see here. Move along....
I consider it should display
<h1>This is order: hello!</h1>
is anyone know how to solved this problem, thanks.