CodeIgniter Forums
URI Routing - Printable Version

+- CodeIgniter Forums (
+-- Forum: CodeIgniter 4 (
+--- Forum: CodeIgniter 4 Support (
+--- Thread: URI Routing (/thread-76094.html)

URI Routing - Nome - 04-14-2020

Hello, yesterday I wrote in a similar topic, but it was already lost and the information on this issue went in parts. Therefore, I still decided to create a new topic and collected all the information in one place, which can help:
Quote:When I submit the form (located at site/user) by post to the site/user/add address, I get the following machine response:

404 - File Not Found
Controller or its method is not found: User::add
PHP Code:
        $psr4 = [
'App'               => APPPATH,                // To ensure filters, etc still found,
APP_NAMESPACE       => APPPATH,                // For custom namespace
'Config'              => APPPATH .  'Config',
'Modules\User'        => ROOTPATH 'modules/User',
PHP Code:
Quote:Yesterday @includebeer suggested that I set the AutoRoute value to "false".
As a result, we received the following response from the machine:
Can't find a route for 'user/add'.
PHP Code:
->group('user', ['namespace' => 'Modules\User\Controllers'], function($routes)
    $routes->get('/',       'User::index');
    $routes->post('add',    'User::createUser');
    $routes->post('load',   'User::load');
PHP Code:
<?php namespace Modules\User\Controllers;

User extends \CodeIgniter\Controller
    public function createUser() {
        $model = new UserModel();
        $model->createUser($data = [
            'mail'        => $this->request->getPost('mail'),
            'timezone'    => $this->request->getPost('timezone')
        return redirect()->back();
        //return redirect()->back();
... <?= form_open(
            'class' => '',
            'id'    => 'form'
?> ...
Help me figure out the question, maybe I just need to reinstall the framework ...