![]() |
Hello,
I'm creating a feature for my website that requires to send a custom error page, while keeping the default one for the rest of the website. The controller haves to send different error code (404, 501...) and its corresponding page using a code similar to this : Code: throw new ImageException(404, "error Message") Code: throw new ImageNotFound("error message"); It is possible to achieve such thing ? (I tried this, but it doesn't work : ) Image.php : PHP Code: // ... ImageException.php : PHP Code: <?php
Actually learning CodeIgniter4 and creating a complex CMS system for fan-translations teams (Kagescan)
@LoganTann on GitHub // French // He-Him
I'm not sure if I get your situation correctly. Do you want to throw an exception when a certain page is accessed in the browser? So, for example, if a user accesses the /image page defined by the Image controller you want to throw a 404 error?
PHP Code: public function index()
(07-16-2021, 08:37 AM)paulbalandan Wrote: I'm not sure if I get your situation correctly. Do you want to throw an exception when a certain page is accessed in the browser? So, for example, if a user accesses the /image page defined by the Image controller you want to throw a 404 error?Hi, thanks for the reply. I managed to solve this, but the question was 'is there a way to return 404 error code with a custom view in the body response'. I no longer need an anwser with this question, I complete it manually using the response class.
Actually learning CodeIgniter4 and creating a complex CMS system for fan-translations teams (Kagescan)
@LoganTann on GitHub // French // He-Him |
Welcome Guest, Not a member yet? Register Sign In |