--- tags: PHP, Backend, Laravel --- # Laravel7 Route pattern cannot reference variable name more than once 在路由設置為以下時發生錯誤: `Route::resource('/temporary/{store_id}', 'Store\TemporaryTimeController');` 錯誤訊息如下: `Route pattern "/temporary/{store_id}/{{store_id}}" cannot reference variable name "store_id" more than once.` 應該是resource 會自動將 route 最後的那個單詞作為變量,所以出現了報錯日誌中的變量名重複的問題。 解決辦法: 路由不以變量為結尾,多加上文字 Route::resource('/temporary/{store_id}', 'Store\TemporaryTimeController');
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up