php - How to route all url with same prefix to one action -
i want route url same prefix same action like:
http://host/pic/with/bird/with/fish
http://host/pic/with/pig/theme/sad/resolution/high
all piccontroller@showpic
i tried write route
route::get("/pic/*","piccontroller@showpic"); to route url start /pic/ same function. route * not work.
if take @ illuminate\routing\route, has method called where() this. comment on method says "set regular expression requirement on route."
that this:
route::get('/pic/{section}', 'piccontroller@showpic')->where(['section' => '.*']); essentially meaning take after /pic/ part , pass variable showpic() method. now, parsing on method should easy simple explode() on forward slash assuming have sort of pattern or trying each of values.
Comments
Post a Comment