"Json" as controller name does not work |
Well i've faced a very weird issue.
If i create a controller named "Json" and try to access it i get an "Object not found" error in my CI project. On the other hand if i give the controller another name it'll work like a charm or if i use an Uppercase first letter it will also work. Here's my controller, filename and routes files. Json.php PHP Code: <?php Routes.php PHP Code: $route['(?i)json'] = 'json'; Any ideas? //Life motto if (sad() == true) { sad().stop(); develop(); }
Strange I just ran it with CodeIgniter 3.1.11 with no errors without using routes.
Maybe something to do with your routing. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(10-29-2019, 03:42 AM)InsiteFX Wrote: Strange I just ran it with CodeIgniter 3.1.11 with no errors without using routes. Well my full routing file is: PHP Code: <?php I' ll check if there's something wrong with the .htaccess file. //Life motto if (sad() == true) { sad().stop(); develop(); }
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 { Notice that index has an optional argument. If you add that then you don't need this route. PHP Code: $route['json'] = 'json'; |
Welcome Guest, Not a member yet? Register Sign In |