Welcome Guest, Not a member yet? Register   Sign In
Custom error exception like PageNotFoundException
#1

(This post was last modified: 01-16-2020, 04:24 AM by XTAZ.)

Hello!

I need function to show 403 error in CI like throw \CodeIgniter\Exceptions\ForbiddenException::forbidden();

I created own exception handler, but if I replace protected $code = 404; to protected $code = 403; I getted error page instead page like 404.

How can I create a handler?

Or I needs use function with exit method like this?
PHP Code:
function show_forbidden()
{
    
header('HTTP/1.0 403 Forbidden');
    echo 
view('forbidden_page');
    exit;

Reply
#2

SEE: Lonnie's Myth/Auth and look at how he is adding Exceptions in to an Exceptions folder.

Myth:Auth
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB