Hi.
I am new to CodeIgniter 4. I am facing a few problems. Please help to resolve these.
Environment:
WAMP Server
PHP 8.1
Installation:
I am trying to install using Composer. But unable to get version 4.3 but get 4.19.
Is there any possibility of using install 4.3?
Problem:
I am following the example documentation of static pages, but receive the below error.
class_exists() expects parameter 1 to be string, array given
Here is the code.
Routes.php
Quote:$routes->get('/', 'Home::index');
use App\Controllers\Pages;
$routes->get("/home", [ Pages::class, "index" ]);
Pages.php
Quote:<?php
namespace App\Controllers;
use CodeIgniter\Exceptions\PageNotFoundException;
class Pages extends BaseController
{
public function index()
{
return view("pages/home");
}
}
home.php
Quote:<h1>Welcome</h1>
Looking forward to resolving the issue.
Awaiting a reply ASAP.
Thanks.