gpt4 book ai didi

regex - 带有语言环境的安全区域

转载 作者:行者123 更新时间:2023-12-04 20:09:54 26 4
gpt4 key购买 nike

我如何使用语言环境保护操作 - 这在 symfony1.4 中非常简单。我现在使用 symfony2.3:

我的安全.yml:

firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false

login:
pattern: frontend_account_login
security: false


secured_area:
pattern: ^/
anonymous: ~
http_basic:
realm: "Secured Demo Area"
form_login:
check_path: frontend_account_security_check
login_path: frontend_account_login
use_referer: true
default_target_path: frontend_account_hello
logout:
path: /logout
target: frontend_account_login #anonymous: ~
#http_basic:
# realm: "Secured Demo Area"

access_control:
#This works:
- { path: ^/de/account/secured/, roles: ROLE_ADMIN }
- { path: ^/en/account/secured/, roles: ROLE_ADMIN }
#I want it kind of that way
- { path: ^/{_locale}/account/secured/, roles: ROLE_ADMIN }

我读了一篇带有正则表达式的帖子:^/[a-z]+/account/secured/。但它不起作用。知道如何使用语言环境保护区域。我在这里找到了一些帖子,但它们都不起作用。

谢谢!!!

最佳答案

如果您只有两个语言环境:

- { path: ^/(en|de)/account/secured/, roles: ROLE_ADMIN }

关于regex - 带有语言环境的安全区域,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19513533/

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