• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Custom error exception like PageNotFoundException

#1
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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.