How to show 404 page in Codeigniter 4? |
Although it may seem trivial, I am having difficulty with a question. Previously in Codeigniter 3, I utilized the show_404() function in any controller to display a 404 page. How can I achieve the same outcome in Codeigniter 4?
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
If you want to use CI3 features in CI4, you may find ci-3-to-4-upgrade-helper helpful.
For example, https://github.com/kenjis/ci3-to-4-upgra...on.php#L52 |
Welcome Guest, Not a member yet? Register Sign In |