Welcome Guest, Not a member yet? Register   Sign In
Controller or its method is not found: \App\Controllers\Tasks::index
#1
Question 
(This post was last modified: 07-11-2022, 08:27 AM by Ahmed Haroon.)

simply unzipped CodeIgniter ver 4.1.9 in d:\xampp\htdocs folder and rename it to taskapp.
in .env file :

CI_ENVIRONMENT = development
app.baseURL = 'http://localhost:8088/taskapp/public'

in Routes.php i set :
$routes->setAutoRoute(true);

in browser i can run successfully: http://localhost:8088/taskapp/public
created a folder in Views and a file under this folder index.php
in Controllers modified Home.php to return that view file successfully.
return view('Home/index');

all 3 url's are working fine, showing the same page:
http://localhost:8088/taskapp/public
http://localhost:8088/taskapp/public/home
http://localhost:8088/taskapp/public/home/index

copied that Home.php in Controllers and rename it to Tasks.php which contents are as below:


PHP Code:
<?php

namespace App\Controllers;

class 
Tasks extends BaseController
{
    public function index()
    {
        return view('Tasks/index');
    }


created a folder in Views named Tasks and under this folder created a file index.php which contents i copied from index.php as below:

PHP Code:
<!DOCTYPE html>
<
html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>Tasks</title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="">
    </head>
    <body>
        <h2>Welcome Tasks!</h2>
    </body>
</
html

in browser trying to access below but it shows error:
http://localhost:8088/taskapp/public/tasks

404 - File Not Found
Controller or its method is not found: \App\Controllers\Tasks::index

what i missed or doing wrong here? please guide
regards
Newbie here in CodeIgniter World !! Please appologize if any nonsense from me.  
environment: Windows 10, XAMPP 3.3.0, VS Code, SQLyog Community Ed. 
Reply


Messages In This Thread
Controller or its method is not found: \App\Controllers\Tasks::index - by Ahmed Haroon - 07-11-2022, 07:05 AM



Theme © iAndrew 2016 - Forum software by © MyBB