Questions tagged [codeigniter-4]

CodeIgniter 4.x is the latest major version tree of the popular PHP-based framework. CodeIgniter is an Application Development Framework - a toolkit - primarily for people who build websites using PHP. Please refer to the [codeigniter] tag for more information.

CodeIgniter 4.0.3 is the latest release, targeted for PHP7+ only and is not intended to be backwards-compatible with previous CodeIgniter versions.


What is CodeIgniter?

CodeIgniter is an Application Development Framework - a toolkit - for people who build websites using PHP. Its goal is to enable you to develop projects much faster than you could if you were writing code from scratch by providing a rich set of libraries for commonly needed tasks, as well as a simple interface and logical structure to access these libraries. CodeIgniter lets you creatively focus on your project by minimizing the amount of code needed for a given task.

Codeigniter 4.x is the latest major version tree of the framework. The project (originally from EllisLab) has been completely rewritten and is maintained on GitHub by the British Columbia Institute of Technology.


Please refer to the tag for more information.

1234 questions
30
votes
16 answers

Whoops! We seem to have hit a snag. Please try again later

Whoops! We seem to have hit a snag. Please try again later. Codeigniter 4 shows an error when I run the CI4 application, How I resolve? Changes: public $baseURL = 'http://ci.local'; public $baseURL = 'http://localhost:8080'; public $indexPage =…
Nasir Uddeen
  • 339
  • 1
  • 3
  • 5
17
votes
16 answers

How to remove public/index.php/ from url in Codeigniter 4

I want normal URL like www.sample.com/controller not www.sample.com/public/index.php/controller. RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ public/index.php/$1 [L] My .htaccess …
caveboy
  • 231
  • 1
  • 3
  • 7
15
votes
5 answers

Codeigniter echoing [::1] instead of localhost

I am using CodeIgniter 3 as a web platform and trying to import semantic-UI CSS into my page. I'm doing so by using CodeIgniter's base_url() method in the href property for the CSS import. However, semantic.css itself imports some other fonts on my…
Dalannar
  • 381
  • 1
  • 2
  • 11
13
votes
10 answers

How to get insert id after save to database in CodeIgniter 4

I'm using Codeigniter 4. And inserting new data like this, $data = [ 'username' => 'darth', 'email' => 'd.vader@theempire.com' ]; $userModel->save($data); Which is mentioned here: CodeIgniter’s Model reference It's doing the…
Encrypted
  • 628
  • 1
  • 10
  • 22
12
votes
4 answers

How to work with subdirectory controllers in CodeIgniter 4?

I need help with using sub directory controllers in CodeIgniter 4. I just can't make it work for some reason. This is the URL for example: www.example.com/admin/dashboard In the controllers folder, I created a folder named Admin, and a file named…
Alon Pini
  • 581
  • 1
  • 3
  • 19
10
votes
9 answers

CodeIgniter 4 redirect function not working

After logout, I tried to redirect for the home page. I tried to few ways, but not redirected. class User extends BaseController { public function __construct() { helper('url'); } for the logout function. I used three…
Senthil
  • 757
  • 2
  • 7
  • 25
10
votes
6 answers

How to autoload helper functions in codeigniter 4

I just downloaded CodeIgniter 4 from their official GitHub. They changed a lot from CodeIgniter 3. I want to use base_url() function in the view and for that, you need to load URL helper and in CodeIgniter 3 I autoloaded it in config/autoload.php…
Geordy James
  • 2,358
  • 3
  • 25
  • 34
6
votes
7 answers

How to debug Codeigniter 4

whatever error occurs in Codeigniter 4 Its always showing default message How to get exact error message in Codeigniter 4
Boominathan Elango
  • 1,156
  • 2
  • 7
  • 20
6
votes
8 answers

What's the equivalent of $this->db->last_query() in Codeigniter 4?

I just started learning Codeigniter 4. My query always generates NULL and I don't know why. How can I see the generated SQL Select command just like Codeigniter 3? In Codeigniter 3 this command does the job: echo $this->db->last_query(); And this…
rostamiani
  • 2,859
  • 7
  • 38
  • 74
5
votes
4 answers

Call to undefined function CodeIgniter\locale_set_default() - Xampp

I'm trying to set up Codeigniter4 with Xampp but when calling the public address http://localhost/projectfolder/public/index.php as stated in the README.md file of the CodeIgniter4 framework, the next error appears:
Fatal error:…
Pol
  • 454
  • 2
  • 4
  • 12
5
votes
1 answer

Codeigniter 4 Entity Property cast as array not autoserializing

I'm trying to cast an entity property into an array so that it autoserializes. The Entity is set up as follows \App\Entities\Submission.php
5
votes
4 answers

codeigniter 4 set session variable $session = \Config\Services::session(); globally

in codeigniter 4 as per the documentation we have to load library as $session = \Config\Services::session(); if i write it on above of controller name
dharmx
  • 694
  • 1
  • 13
  • 20
5
votes
3 answers

Error returned when trying to initiate pagination in Codeigniter 4

I'm trying to initiate the pagination function in Codeigniter 4 as per the documentation. $model = new \App\Models\UserModel(); $data = [ 'users' => $model->paginate(10), 'pager' => $model->pager ]; My controller code is the…
kanarifugl
  • 9,887
  • 5
  • 29
  • 39
5
votes
5 answers

Not redirected to specific URL in Codeigniter 4

Why is it that whenever I redirect something through the constructor of my Codeigniter 4 controller is not working?
user3569641
  • 892
  • 1
  • 17
  • 50
5
votes
5 answers

How can I load css or js file in codeigniter 4?

When I am trying to load css or javascript file then it returns 404 error. I've tried to use helpers such as HTML helper's link_tag, URL helper's base_url methods, it will make a route to the file, but not loadable. This is my Controller: class…
YJM
  • 133
  • 1
  • 2
  • 11
1
2 3
82 83