Welcome Guest, Not a member yet? Register   Sign In
Adding a new class and view show "404 page not found" Error
#1

(This post was last modified: 08-19-2022, 07:20 AM by postgres.)

Dear Friends,
I am new to codeigniter 4 , installed it in Wamp in my Windows 10 Laptop. I followed the tutorial in the site The Complete CodeIgniter 4 Tutorial For Beginners and installation successful and see the sample home page . But according to it I added a new controller with code 
Code:
 namespace App\Controllers;
use CodeIgniter\Controller;

class Hello extends Controller
{
    public function index()
    {
        $data['title'] = "Hello World from Codeigniter 4";
        echo view('hello_view', $data);
    }

}
and view as 

<!DOCTYPE html>
Code:
<html lang="en">
Code:
<head>
Code:
    <meta charset="UTF-8">
Code:
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
Code:
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
Code:
    <title><?php echo $title; ?></title>
Code:
</head>
Code:
<body>
Code:
    <h2><?php echo $title; ?></h2>
Code:
</body>
Code:
</html>

But when run the code I got "404 page not found" Error..

Why ? please advise

Thanks
Anes P.A
Reply




Theme © iAndrew 2016 - Forum software by © MyBB