2
I wonder what this $ means in defining routes, for example :
route["(.*)-sid-(:num)-(:num)"] = "services/service/$2/$3";
What it represents $2and $3?
2
I wonder what this $ means in defining routes, for example :
route["(.*)-sid-(:num)-(:num)"] = "services/service/$2/$3";
What it represents $2and $3?
4
These are groupings of captured characters from a Regular Expression or RegEx.
In its case, Codeigniter can define the routes with the groupings of Regular Expressions within the parentheses, where in: $route["(.*)-sid-(:num)-(:num)"] = "services/service/$2/$3";, $2 and $3 respectively represent the groups of numeric characters (:num) and (:num) and $1 capture a group of characters if available (.*)
Perfect explanation, thank you!
Browser other questions tagged php codeigniter route
You are not signed in. Login or sign up in order to post.
According to the manual:
$route['products/([a-z]+)/(\d+)'] = "$1/id_$2"; URL:products/shirts/123->$1 = shirts e $2 = id_123. Represent the parameters of the route you set.– Papa Charlie
are only variables representing the ID and Function that will be passed to the url
– Saymon