Routes - CodeIgniter

2

I wanted to know what this $ means in the definition of the routes, for example:

route["(.*)-sid-(:num)-(:num)"] = "services/service/$2/$3";

What does $2 and $3 ?

    
asked by anonymous 09.04.2015 / 16:41

1 answer

4

These are groupings of characters captured from a Regular Expression or RegEx .

In your case, CodeIgniter can define the routes with regular expression clusters within the parentheses, where: $route["(.*)-sid-(:num)-(:num)"] = "services/service/$2/$3"; , $2 and $3 represent respectively the numeric character groups (:num) and (:num) and $1 captures a group of characters if there is (.*)

    
09.04.2015 / 19:50