Welcome Guest, Not a member yet? Register   Sign In
"Json" as controller name does not work

(This post was last modified: 10-29-2019, 10:35 AM by dave friend.)

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'

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

Theme © iAndrew 2016 - Forum software by © MyBB