• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
"Json" as controller name does not work

#4
The following isn't very useful because it basically asks that you follow CI's normal controller/method/arg URI relationship

PHP Code:
$route['json/(:any)']  'json/$1' 

In other words, you're not actually remapping anything.

You really need to know which method you want to run and put that in the value. For instance, if you want it all to go to index().

PHP Code:
$route['json/(:any)']  'json/index/$1' 

Naturally, index() would need to accept arguments, i.e..

PHP Code:
class Json extends CI_Controller {
 public function 
index($arg null){
  // Some code
 
}


Notice that index has an optional argument. If you add that then you don't need this route.

PHP Code:
$route['json'] = 'json'
Reply


Messages In This Thread
RE: "Json" as controller name does not work - by dave friend - 10-29-2019, 07:16 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.