Symfony-参数synatx和重定向

问题描述 投票:1回答:1

我在Symfony项目的parameter.yml中定义了自定义路线。

当我重定向时,我的函数正在与用户的{hash}发送该路由,但会引发错误。

必须定义参数“ front_url2e6f62b5822e1b383ab409219f905d06”。

randon编号代表我的用户哈希。

我的parameters.yml

parameters:
    front_url: 'https://my.custom-route.net/email/confirm/{hash}'

我是否需要以其他方式在参数中定义我的{hash}路由部分,否则问题可能是其他吗?

php symfony routes symfony-3.4
1个回答
0
投票

我在Symfony项目的parameter.yml中定义了自定义路线。

// routes.yaml    
custom_routes:
    resource: 'custom_routes.yaml'
    prefix:   /

// custom_routes.yaml
front_url:
    path: '%front_url%'
    defaults:
        _controller: App\Controller\HashController:hash
        hash: false

parameters:
    front_url: 'https://my.custom-route.net/email/confirm/{hash}'       
© www.soinside.com 2019 - 2024. All rights reserved.