第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

Symfony 路由以區(qū)分不明確的路徑

Symfony 路由以區(qū)分不明確的路徑

PHP
慕容3067478 2021-06-03 07:10:32
我有 Symfony 路由問題。即使我在兩個(gè)不同路由的路徑中使用了不同的參數(shù),Symfony 也將其識別為一個(gè)模式并指向路由文件中首先定義的路徑。例如:app_restaurants_inner:    path:     /london-restaurants/{id}/{restaurant_name}.html    defaults: { _controller: AppBundle:Restaurants:inner}app_restaurants_by_cuisine:    path:     /london-restaurants/cuisine/{cuisine}.html    defaults: { _controller: AppBundle:Restaurants:index}第一個(gè)路由加載一個(gè)特定的餐廳,參數(shù)是 id 和餐廳名稱。餐廳名稱僅包含 az、0-9 和連字符。在第二個(gè)參數(shù)中,只有一個(gè)參數(shù)是美食。但是,當(dāng)我嘗試加載美食(第二條路線)時(shí),它會(huì)將我引導(dǎo)至與美食路徑相似的餐廳路徑。另一方面,以下路線也被標(biāo)識為類似于餐廳的路徑。app_restaurants_by_cuisine_letter:    path:     /london-restaurants/cuisine/{cuisine}-{letter}.html    defaults: { _controller: AppBundle:Restaurants:index}單詞“cuisine”標(biāo)識為“{id}”,“{cuisine}-{letter}”標(biāo)識為“{restaurant_name}”。我怎樣才能解決這個(gè)問題?
查看完整描述

1 回答

?
ibeautiful

TA貢獻(xiàn)1993條經(jīng)驗(yàn) 獲得超6個(gè)贊

您應(yīng)該在路由定義中添加一些要求

app_restaurants_inner:

    path:     /london-restaurants/{id}/{restaurant_name}.html

    defaults: { _controller: AppBundle:Restaurants:inner}

    requirements:

        id: '\d+'


app_restaurants_by_cuisine:

    path:     /london-restaurants/cuisine/{cuisine}.html

    defaults: { _controller: AppBundle:Restaurants:index}


查看完整回答
反對 回復(fù) 2021-06-04
  • 1 回答
  • 0 關(guān)注
  • 209 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號