我試圖顯示一個基於url的搜索框,意思是特定的路由,它會顯示搜索框,否則它不會顯示。爲此,我使用Request::path()
。但問題在於某些路線不起作用。 假設我有拖路線。如Laravel:如何使用Request :: path()檢查動態url()
Route::get('products','[email protected]');
Route::get('product/{name}','[email protected]');
現在
,如果我使用
@if(Request::path() == 'products' || Request::path() == 'product/{name}')
// something print
@endif
爲products
路線我可以看到搜索框但product/{name}
我不能..我要如何解決問題?
你檢查'支持::路徑()'價值? –
您可以從[這裏](https://stackoverflow.com/q/26840278/2679536)獲得適當的解決方案! –