Welcome Guest, Not a member yet? Register   Sign In
How to show 404 page in Codeigniter 4?
#2

You can use the following command to display it.

PHP Code:
throw \CodeIgniter\Exceptions\PageNotFoundException::forPageNotFound(); 

But if you want to use show_404(), you can add the following code in file app/Common.php.

PHP Code:
<?php

use CodeIgniter\Exceptions\PageNotFoundException;

// Show 404 error

if (!function_exists('show_404')) {

    function show_404(string $error_text): string
    
{

        throw PageNotFoundException::forPageNotFound($error_text);

    }

Reply


Messages In This Thread
RE: How to show 404 page in Codeigniter 4? - by datamweb - 02-27-2023, 08:04 AM



Theme © iAndrew 2016 - Forum software by © MyBB