routing - What's the difference between "(:any)" and ":any" in CodeIgniter? -


what's difference between "(:any)" , ":any" in codeigniter uri routing rules? example:

segment_1/segment_2/:any = my_controller/function/$1 

and

segment_1/segment_2/(:any) = my_controller/function/$1 

i don't see explanation in ci docs , wondered. :)

there difference between :any , (:any).

first (:any) replaced $1 second (:any) replaced $2 , on

but :any not have effect.

as example,suppose have test controller function name myfunction takes arguemnt $a

class test extends ci_controller {     public function myfunction($a='')     {          echo $a;     } } 

hit url baseurl/test/asdf

 $route['test/(:any)']='test/myfunction/$1';  //$1== asdf  //outputs  asdf   $route['test/:any']='test/myfunction/$1'; //$1!=asdf //outputs $1 

hope understand difference.


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

android - CollapsingToolbarLayout: position the ExpandedText programmatically -

Listeners to visualise results of load test in JMeter -