Welcome Guest, Not a member yet? Register   Sign In
Controller in for sub-directory
#1
Question 

Hello!

I try create controller in sub-directory, but get 404 error.
I just follow documentation https://codeigniter4.github.io/CodeIgnit...irectories and create folder "one" and file in folder "Hello.php":

PHP Code:
<?php namespace App\Controllers;

class 
Hello extends BaseController
{

    public function method()
    {
        echo 'success';
    }



App/Controllers/one/hello/method

Codeigniter has been installed in sub-directory site.com/backend
Now i try call controller by link site.com/backend/one/hello/method and i get 404 error - "Controller or its method is not found: App\Controllers\One::hello".

How to create controller files correctly in sub-diectory?

Thank you!
Reply
#2

Your Hello controller needs the proper namespace ...
Code:
<?php namespace App\Controllers\one;
Reply
#3

(09-07-2019, 05:50 AM)ciadmin Wrote: Your Hello controller needs the proper namespace ...
Code:
<?php namespace App\Controllers\one;

Thank you!

It worked!
Reply




Theme © iAndrew 2016 - Forum software by © MyBB