Cannot access method in Controller!? |
I've set this in my App\Config\App.php: public $baseURL = 'http://localhost/my_project/';
I've added this in my Home Controller: Code: <?php namespace App\Controllers; I've copied the index.php and .htaccess from the public directory into the root and modified the path accordingly: Code: $pathsPath = realpath(FCPATH . 'app/Config/Paths.php'); // removed the preceding dots ../ I've also added the view test.php in the Views directory ... Now, why can't I access the test method in the Home controller by doing this: Code: http://localhost/my_project/test ? Well. Maybe because I didn't add the Controller name before the method OR didn't set it specifically in the Routes.php ... I just 'thought' that, as the default controller is set, it would 'automagically' use that if left out ... but that would probably have been a bit weird ... so.
OK, so I received an e-mail that someone had replied to my post:
Code: blaasvaer, But I don't see the reply in the thread!?
To prevent other answers I'll throw my own quick replies as a 'regular' reply.
Well. Maybe because I didn't add the Controller name before the method OR didn't set it specifically in the Routes.php ... I just 'thought' that, as the default controller is set, it would 'automagically' use that if left out ... but that would probably have been a bit weird ... so.
That's why I deleted my reply, as I noticed you had already found out why. xD
(09-02-2020, 12:42 AM)jreklund Wrote: That's why I deleted my reply, as I noticed you had already found out why. xD Well, I ‘guess’ the system failed to notify me about the deletion then ... which I think would be the proper respond from a system like this ... but maybe that’s just me. Thanks anyway.
Why the learn/test curve in ci4 is so high?....
simple things, just starting - and already i'm in forums QA. out of the box - Index method works in default controller. why not other methods? how to call other methods? any call result with : Cannot access the default controller "Home" with the controller name URI path. can't be that there is no simple answer to it.
You need to define all routes you want.
See https://codeigniter4.github.io/CodeIgnit...ting-rules |
Welcome Guest, Not a member yet? Register Sign In |