Welcome Guest, Not a member yet? Register   Sign In
Failed to auto loading the routes.php
#3

(This post was last modified: 07-28-2021, 11:14 PM by mjamilasfihani.)

PHP Code:
// My Autoload
public $psr4 = [
    APP_NAMESPACE => APPPATH// For custom app namespace
    'Config'      => APPPATH 'Config',
    'Myth\Auth'   => APPPATH 'ThirdParty/myth-auth/src',
    'Acme'        => ROOTPATH 'acme',
];

// My Controller
// Location : ROOTPATH . 'acme/Home/Controllers'
namespace Acme\Home\Controllers;

use 
App\Controllers\BaseController;

class 
Test extends BaseController
{
   public function index()
   {
       echo "string";
   }
}

// My Route
// Location : ROOTPATH . 'acme/Home/Config'
$routes->get('test''\Acme\Home\Controllers\Test::index');

// And the result is
// Controller or its method is not found: \App\Controllers\Test::index 

For now, it's okay for me because I use MVC instead. But I'll try to check later with a fresh CodeIgniter4
Reply


Messages In This Thread
RE: Failed to auto loading the routes.php - by mjamilasfihani - 07-28-2021, 11:12 PM



Theme © iAndrew 2016 - Forum software by © MyBB