经过测试很简单,到Phalcon项目目录/app/config/services.php 文件注册di :
/**
* Load Router 注册路由
*/
/*$di->set('router', function () {
return require __DIR__ . '/routes.php';
});*/
/app/config/目录下新建routes.php文件并配置:
<?php
$router = new \Phalcon\Mvc\Router();
$router->add('/path/to.html', [
'controller' => 'routes',
'action' => 'index',
]);
//$router->notFound(array('controller'=>'httperr','action'=>'err404'));
return $router;
访问地址:http://localhost/path/to.html
试试看是不是访问到routes控制器下的index动作。

