想要更改 phalcon 默认路由
Want to change phalcon default route
我想更改 phalcon
中的默认路由,这是 indexcontroller
的索引操作。
我的routes.php
:
$router = new \Phalcon\Mvc\Router();
//Define a route
$router->add(
"/",
array(
"controller" => "admin", //previously it was "index"
"action" => "index",
)
);
$router->handle();
现在,当我在浏览器中打开我的网站(例如 http://localhost/test/
)时,出现错误:
IndexController handler class cannot be loaded
#0 [internal function]: Phalcon\Mvc\Dispatcher->_throwDispatchException('IndexController...', 2)
#1 [internal function]: Phalcon\Dispatcher->dispatch()
#2 C:\wamp\www\test\public\index.php(36): Phalcon\Mvc\Application->handle()
#3 {main}
我很困惑为什么我的路线在路线文件中被替换后仍然会indexcontroller
?
要设置您需要使用的默认控制器-
$router->setDefaults(array(
'controller' => 'admin',
'action' => 'index'
));
我想更改 phalcon
中的默认路由,这是 indexcontroller
的索引操作。
我的routes.php
:
$router = new \Phalcon\Mvc\Router();
//Define a route
$router->add(
"/",
array(
"controller" => "admin", //previously it was "index"
"action" => "index",
)
);
$router->handle();
现在,当我在浏览器中打开我的网站(例如 http://localhost/test/
)时,出现错误:
IndexController handler class cannot be loaded
#0 [internal function]: Phalcon\Mvc\Dispatcher->_throwDispatchException('IndexController...', 2)
#1 [internal function]: Phalcon\Dispatcher->dispatch()
#2 C:\wamp\www\test\public\index.php(36): Phalcon\Mvc\Application->handle()
#3 {main}
我很困惑为什么我的路线在路线文件中被替换后仍然会indexcontroller
?
要设置您需要使用的默认控制器-
$router->setDefaults(array(
'controller' => 'admin',
'action' => 'index'
));