我正在使用zfcUser,我想知道是否可以禁用默认路由,例如zfcUser/login、zfcUser/register等,因为我不想暴露它们。
我看了看zfcuser.global.php,但似乎没有这样的选项?
谢谢
发布于 2013-03-19 16:59:02
您可以通过设置空控制器或不匹配的路由配置来简单地覆盖配置。
解决方案1:覆盖可调用的zfcuser控制器:
// YourApp\Module#getConfig() or config/autoload/zfcuser.override.global.php
return array(
'controllers' => array(
'invokables' => array(
'zfcuser' => null,
),
),
);解决方案2:使用您自己的路由配置覆盖路由配置(hacky,不鼓励):
// YourApp\Module#getConfig() or config/autoload/zfcuser.override.global.php
return array(
'router' => array(
'routes' => array(
'zfcuser' => array(
// changing to hostname route - using an unreachable hostname
'type' => 'Hostname',
// minimum possible priority - all other routes come first.
'priority' => ~PHP_INT_MAX,
'options' => array(
// foo.bar does not exist - never matched
'route' => 'foo.bar',
'defaults' => array(
'controller' => null,
'action' => 'index',
),
),
// optional - just if you want to override single child routes:
'child_routes' => array(
'login' => array(
'options' => array(
'defaults' => array(
'controller' => null,
),
),
),
'authenticate' => array(
'options' => array(
'defaults' => array(
'controller' => null,
),
),
),
'logout' => array(
'options' => array(
'defaults' => array(
'controller' => null,
),
),
),
'register' => array(
'options' => array(
'defaults' => array(
'controller' => null,
),
),
),
'changepassword' => array(
'options' => array(
'defaults' => array(
'controller' => null,
),
),
),
'changeemail' => array(
'options' => array(
'defaults' => array(
'controller' => null,
),
),
),
),
),
),
),
);https://stackoverflow.com/questions/15494787
复制相似问题