gpt4 book ai didi

zend-framework2 - 禁用默认的 zfcUser 路由?

转载 作者:行者123 更新时间:2023-12-04 05:06:25 24 4
gpt4 key购买 nike

我正在使用 zfcUser我想知道是否可以禁用默认路由,例如 zfcUser/login , zfcUser/register等,因为我不想暴露它们。

我看了zfcuser.global.php但似乎没有这样的选择?

谢谢

最佳答案

您可以通过设置空 Controller 或无法匹配的路由配置来简单地覆盖配置。

解决方案 1:覆盖 zfcuser Controller 可调用:

// 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,
),
),
),
),
),
),
),
);

关于zend-framework2 - 禁用默认的 zfcUser 路由?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15494787/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com