Welcome Guest, Not a member yet? Register   Sign In
Controller or its method is not found
#6

Cannot reproduce.


PHP Code:
<?php

namespace App\Controllers\Member;

use 
App\Controllers\BaseController;
use 
CodeIgniter\HTTP\ResponseInterface;

class 
Dashboard extends BaseController
{
    public function index()
    {
        return __METHOD__;
    }


Code:
diff --git a/app/Config/Routes.php b/app/Config/Routes.php
index fc4914a692..80226ae341 100644
--- a/app/Config/Routes.php
+++ b/app/Config/Routes.php
@@ -5,4 +5,4 @@ use CodeIgniter\Router\RouteCollection;
/**
  * @var RouteCollection $routes
  */
-$routes->get('/', 'Home::index');
+//$routes->get('/', 'Home::index');
diff --git a/app/Config/Routing.php b/app/Config/Routing.php
index 47bf5ff8e5..e1941480f9 100644
--- a/app/Config/Routing.php
+++ b/app/Config/Routing.php
@@ -61,7 +61,7 @@ class Routing extends BaseRouting
      *
      * Default: false
      */
-    public bool $translateURIDashes = false;
+    public bool $translateURIDashes = true;

    /**
      * Sets the class/method that should be called if routing doesn't
@@ -89,7 +89,7 @@ class Routing extends BaseRouting
      *
      * If FALSE, will stop searching and do NO automatic routing.
      */
-    public bool $autoRoute = false;
+    public bool $autoRoute = true;

    /**
      * If TRUE, will enable the use of the 'prioritize' option

Code:
$ php spark routes

CodeIgniter v4.4.6 Command Line Tool - Server Time: 2024-03-25 01:28:52 UTC+00:00

+--------+------------------------------+------+------------------------------------------+----------------+---------------+
| Method | Route                        | Name | Handler                                  | Before Filters | After Filters |
+--------+------------------------------+------+------------------------------------------+----------------+---------------+
| auto  | /                            |      | \App\Controllers\Home::index            |                | toolbar      |
| auto  | home                        |      | \App\Controllers\Home::index            |                | toolbar      |
| auto  | home/index[/...]            |      | \App\Controllers\Home::index            |                | toolbar      |
| auto  | member/dashboard            |      | \App\Controllers\Member\Dashboard::index |                | toolbar      |
| auto  | member/dashboard/index[/...] |      | \App\Controllers\Member\Dashboard::index |                | toolbar      |
+--------+------------------------------+------+------------------------------------------+----------------+---------------+

Navigate to http://localhost:8080/member/dashboard,
I see
Code:
App\Controllers\Member\Dashboard::index
Reply


Messages In This Thread
RE: Controller or its method is not found - by kenjis - 03-24-2024, 06:30 PM



Theme © iAndrew 2016 - Forum software by © MyBB