gpt4 book ai didi

php - 后端的 url_for 或 link_to 与管理生成器 Symfony

转载 作者:可可西里 更新时间:2023-10-31 22:47:29 27 4
gpt4 key购买 nike

在 backend_dev 中,我使用管理生成器模块生成新闻:

localhost/backend_dev.php/news/2/edit

this is link for edit News ID 2. How can i generate this link for other ID?

url_for('news/edit?id=2')

不工作,输出是:

localhost/backend_dev.php/news/edit/action?id=1

In routing i have only:

news:
class: sfDoctrineRouteCollection
options:
model: News
module: News
prefix_path: /news
column: news_id
with_wildcard_routes: true

最佳答案

您的路由已将标识符列定义为 news_id,因此请尝试将您的 url 创建更改为

url_for('news/edit?news_id=2')

关于php - 后端的 url_for 或 link_to 与管理生成器 Symfony,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7256460/

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